atcoder#ARC141A. [ARC141A] Periodic Number
[ARC141A] Periodic Number
Score : points
Problem Statement
For a positive integer , let be the string representing in decimal.
We say that a positive integer is periodic when there exists a positive integer such that is the concatenation of two or more copies of . For example, , , and are periodic.
You are given a positive integer at least . Find the greatest periodic number at most . It can be proved that there is at least one periodic number at most .
You will get test cases to solve.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Each case is given in the following format:
Output
Print lines. The -th line should contain the answer for the -th test case.
3
1412
23
498650499498649123
1313
22
498650498650498650
For the first test case, the periodic numbers at most include , , , , and the greatest is .