Decreasing String

Why am i getting WA??Is my approach wrong??if wrong please help…

question-link text

solution-link text

string s=“zyxwvutsrqponmlkjihgfedcba”;
cin>>k;
int l=k%25;
if(l)
for(int i=25-l;i<=25;i++)
cout<<s[i];
int q=(k/25);
while(q–)
cout<<s;

this will work :slight_smile:

what’s wrong with my solution??

oh!!thanks…for pointing out the mistake!!!

:slight_smile: HAPPY CODING

//