# Need any one help on Decreasing string problem

I have a doubt in decreasing string problem CODE: DECSTR
This is my code. It will be helpful if someone pointed out my mistake

#include <stdio.h>
int main(void) {
char a[]=“abcdefghijklmnopqrstuvwxyz”;
int k,t,n;

``````scanf("%d",&t);
while(t--)
{
scanf("%d",&k);
n=(k)%26;
k=k/26;

if(n>=0){
for(int i=n; i>=0; i--){
printf("%c",a[i]);
}
}
while(k--){
for(int i=25; i>=0; i--){
printf("%c",a[i]);
}
}
}

return 0;
``````

}

I stucked in this problem. It will be helpful if someone helped me in this problem

just take the case
t=1
k= 26
bazyxwvutsrqponmlkjihgfedcba
azyxwvutsrqponmlkjihgfedcba

Thanks akman10

Question:
You need to find a string which has exactly K positions in it such that the character at that position comes alphabetically later than the character immediately after it.

I didn;t understand properly. why when k=26 it should print
bazyxwvutsrqponmlkjihgfedcba

See, first of all
From (zyxw…dcba) there are 25 such postion where the given condition follows,
We need k=26 , so one more such position.

In String (zyxw…dcbaba) i have added ba to it at the end.
But we have to print such string that is smallest and lexicographical smaller.
So we add ba at the start not at the end
(bazyxw…dcba) now this is correct
One more example
For k=52,
Got it thanks 