Cycle encoding
Statement
The program:
You're given a string S that contain the substring T, repeated N times (S = T * N).
To express S in a more concise way, we look for the smallest T that satisfy the formula.
For example, if S = "abcabc" then we have T = "abc" and N = 2.
T and N must fully describes S so if S = "abcab", then T = S = "abcab" and N = 1 (since there are no repeating pattern that covers all of S).
To express S in a more concise way, we look for the smallest T that satisfy the formula.
For example, if S = "abcabc" then we have T = "abc" and N = 2.
T and N must fully describes S so if S = "abcab", then T = S = "abcab" and N = 1 (since there are no repeating pattern that covers all of S).
INPUT:
The string S
OUTPUT:
Two integers separated by a space, representing the length of the smallest substring T and the number of times it is repeated in S, respectively.
CONSTRAINTS:
S is not empty
S only contains lowercase characters
S only contains lowercase characters
EXAMPLE:
Input
abcabc
Output
3 2
Game modes
Fastest, Shortest, Reverse
Test cases
Test 1 Test
Input
abcabc
Output
3 2
Test 2 Test
Input
abcabcab
Output
8 1
Test 3 Test
Input
zzzzzz
Output
1 6
Test 4 Test
Input
a
Output
1 1
Test 5 Test
Input
totototo
Output
2 4
Solution language
Solution
Stub generator input