#C13682. Unique Substrings
Unique Substrings
Unique Substrings
Given a string s and an integer k, find all distinct substrings of length k that appear in s. The output must be the unique substrings sorted in lexicographical order. Formally, if we denote by \( S \) the set of all substrings of length \( k \) in \( s \), then the answer is:
\( \text{answer} = \{ t \in S \}\) such that each \( t \) is unique, and the final list is sorted in ascending order.
If no substring of length \( k \) exists, output nothing.
inputFormat
The input is provided via standard input (stdin) and consists of two lines:
- The first line contains a non-empty string s consisting of lowercase letters.
- The second line contains an integer k (\(1 \le k \le 10^5\)).
outputFormat
Print the unique substrings of length k found in s in lexicographical order, each on a new line via standard output (stdout). If there are no such substrings, output nothing.
## sampleabracadabra
3
abr
aca
ada
bra
cad
dab
rac
</p>