Counting Unique Substrings with Length Constraint
Go
Medium
strings
Task «Counting Unique Substrings with Length Constraint»
Write a Go program that takes a string and an integer K. It is necessary to count the number of unique substrings (contiguous sequences of characters) of length K that occur in the string. If K is greater than the length of the string, output 0. The string consists only of lowercase Latin letters.
Input Format
First line: string S (1 ≤ |S| ≤ 10^5). Second line: integer K (1 ≤ K ≤ 10^5).
Output Format
One integer — the number of unique substrings of length K.
Examples
Example 1
INPUT
abcabc
3
OUTPUT
3
Example 2
INPUT
aaaa
2
OUTPUT
1
Example 3
INPUT
2 3
1 2 3
4 5 6
1
OUTPUT
0
main.go