#K71662. Lexicographically Ordered Secure String Generator
Lexicographically Ordered Secure String Generator
Lexicographically Ordered Secure String Generator
You are given an integer n and you need to generate a string of length n composed of lowercase letters ('a' to 'z'). The string must follow a lexicographically ordered pattern. In other words, the string should consist of the first n letters of the English alphabet if n ≤ 26. If n is greater than 26, then the entire alphabet should be repeated as many times as needed. Formally, for a given n, the string S is constructed as:
[ S = \underbrace{\texttt{abcdefghijklmnopqrstuvwxyz} ; \texttt{abcdefghijklmnopqrstuvwxyz} ; \cdots}_{\lfloor n/26 \rfloor \text{ times}} \texttt{abcdefghijklmnopqrstuvwxyz[0:(n \mod 26)]} ]
Your task is to implement the function to generate such a string for each test case.
inputFormat
The first line of input contains an integer T
denoting the number of test cases. Each of the following T
lines contains a single integer n
, representing the length of the string to be generated.
outputFormat
For each test case, output the generated string on a new line to stdout
.
3
5
3
8
abcde
abc
abcdefgh
</p>