Submit | All submissions | Best solutions | Back to list |
DECSTRNG - Decreasing Strings |
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. If there are many such strings, print the one which has the shortest length. If there is still a tie, print the string which comes the lexicographically earliest (would occur earlier in a dictionary).
Input :
The first line contains the number of test cases T. Each test case contains an integer K (<= 100)
Output :
Output T lines, one for each test case, containing the required string.
Example
Sample Input :
2
1
2
Sample Output :
ba
cba
Added by: | Varun Jalan |
Date: | 2010-01-17 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: PERL6 |
Resource: | own problem |
hide comments
2019-01-23 12:32:22
1 <= K <= 100. String can be made of lowercase english letters only. |