#K56722. Repeated Substring Pattern

    ID: 30262 Type: Default 1000ms 256MiB

Repeated Substring Pattern

Repeated Substring Pattern

Given a non-empty string s consisting of only lowercase English letters, determine whether it can be constructed by repeating a substring. Formally, we need to decide if there exists a substring t such that

$$ s = t^k, \quad k \geq 2 $$

For example, if s = "abab", then taking t = "ab" with k = 2 yields s = t^2 and the answer is "YES". Otherwise, for s = "aba", no such substring exists so the answer is "NO".

Your task is to implement a function that reads a string from standard input and prints "YES" if the string can be constructed by repeating one of its substrings, and "NO" otherwise.

inputFormat

The input is provided via standard input (stdin) as a single line containing the string s, where 1 \leq |s| \leq 10^5 and s consists solely of lowercase English letters.

outputFormat

Output a single line to standard output (stdout): "YES" if the string can be constructed by repeating a substring; otherwise, output "NO".

## sample
abab
YES