#C3911. Repeated Substring Checker
Repeated Substring Checker
Repeated Substring Checker
This problem requires you to determine if there exists a substring of a given length \( k \) that appears at least twice in a given string \( s \). The substring occurrences must be at different positions in the string; note that overlapping occurrences are allowed.
Example: For the string "abcabc" with \( k=3 \), the substring "abc" appears twice, so the answer is YES
.
Task: Read the input from standard input. If a substring of length \( k \) exists at least twice, print YES
. Otherwise, print NO
.
Note: The condition for \( k \) is expressed as \(1 \leq k \leq |s|\), where \(|s|\) is the length of the string.
inputFormat
The input consists of two lines. The first line contains the string \( s \) (which may be empty). The second line contains the integer \( k \).
outputFormat
Output a single line with either YES
if there exists a substring of length \( k \) that appears at least twice, or NO
otherwise.
abcabc
3
YES
</p>