Power Strings
Easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Given two strings and we define to be their concatenation.
For example, if and then .
If we think of concatenation as multiplication, exponentiation by a non-negative integer is defined in the normal way:
= “” (empty line)
For a given string print the largest such that for some string .
Input
Each test case is a line representing , a string of printable characters. The length of will be at least and will not exceed characters.
Output
For each input string print in a separate line the largest such that for some string .
Examples
Input #1
Answer #1
Submissions 2K
Acceptance rate 24%