#K70057. Unique Substrings Generation
Unique Substrings Generation
Unique Substrings Generation
Given an integer \(n\) with \(1 \le n \le 26\), generate a string of length \(n\) such that every substring of length \(k\) (for all \(1 \leq k \leq n\)) is unique. In other words, the string must be constructed in such a way that no two substrings of the same length are identical.
The string should consist only of lowercase English letters (a
to z
). A simple observation is that the first \(n\) letters of the English alphabet naturally satisfy the condition. For example:
- For \(n = 1\), the output is
a
. - For \(n = 3\), the output is
abc
. - For \(n = 5\), the output is
abcde
.
Your task is to implement a program that reads an integer from standard input and outputs the corresponding string to standard output.
inputFormat
The input consists of a single integer \(n\) representing the length of the string. It is given via standard input.
Constraints:
- \(1 \le n \le 26\)
outputFormat
Output a string of length \(n\) that satisfies the property that every substring of length \(k\) (for \(1 \leq k \leq n\)) is unique. The output should be written to standard output.
## sample1
a