#K77707. Count Distinct Substrings of Fixed Length
Count Distinct Substrings of Fixed Length
Count Distinct Substrings of Fixed Length
Given a string \(s\) and an integer \(n\), determine the number of distinct substrings of length \(n\) in \(s\). A substring is a contiguous sequence of characters. If \(n\) is greater than the length of \(s\), the answer should be \(0\). For instance, when \(s = \texttt{abcabc}\) and \(n = 3\), the distinct substrings are \(\{\texttt{abc}, \texttt{bca}, \texttt{cab}\}\), so the output is \(3\).
inputFormat
The input consists of two lines:
- The first line contains the string \(s\).
- The second line contains the integer \(n\).
outputFormat
Output a single integer representing the number of distinct substrings of length \(n\) in the string \(s\).
## sampleabcabc
3
3