#K75572. Repeated Substring Pattern

    ID: 34449 Type: Default 1000ms 256MiB

Repeated Substring Pattern

Repeated Substring Pattern

Given a non-empty string s, determine whether s can be constructed by taking a substring of it and repeating that substring several times. Formally, find if there exists a substring t (with length i) such that

\( s = \underbrace{t t \cdots t}_{k \text{ times}} \)

for some integer k ≥ 2. If such a substring exists, output yes followed by the length of the shortest valid substring. Otherwise, output no.

Note: The input string will be provided via standard input (stdin) and the result must be printed to standard output (stdout).

inputFormat

The input consists of a single line containing the non-empty string s composed of English letters.

outputFormat

If the string can be formed by repeating a substring, print "yes" followed by a space and the length of the shortest such substring. Otherwise, print "no".

## sample
abab
yes 2