#K13936. Unique Substrings Generator
Unique Substrings Generator
Unique Substrings Generator
You are given an alphanumeric string \(s\). Your task is to generate all unique substrings of \(s\) and output them in lexicographical order. A substring is defined as a contiguous sequence of characters within the string.
For example, if \(s = "abc"\), the unique substrings are:
[ {a, ab, abc, b, bc, c}]
Note: The generation of substrings involves iterating over all possible contiguous segments of the string. Ensure that your solution considers all cases including strings with repeated characters.
inputFormat
The input consists of a single line containing an alphanumeric string \(s\). The string's length is at least 1.
Input Format:
s
outputFormat
Output all unique substrings of the input string \(s\) in lexicographical (dictionary) order. Each substring should be printed on a separate line.
Output Format:
substring_1 substring_2 ... substring_n## sample
abc
a
ab
abc
b
bc
c
</p>