period
A real number with infinite decimal notation in the range (0,1) is chosen. Partial decimal notation of the chosen number is given with its end cut off. The cutting off is done without rounding. In order to shorten the notation, the part of the number that is repeating is written in brackets.
You need to write a program that finds the shortest possible notation of a given number in bracket form. The length of notation is defined as the number of characters used to represent it. If there is more than one shortest notation, the result is the notation with the least number of digits in brackets.
InputThe first line of standard input contains a sequence of characters, with length not greater that 200.
OutputTo the standard output you shoud write the shortest possible bracket notation for a given number. If there is more than one of them, write the one with the least numbers in brackets.
Input:
Output:
Explanation:
Let 0,223834863 be the notation of infinite decimal number with its end cut off. It can be noted as 0,223(834) or 0,2238(348) or 0,22(38348), because the rest of the number is unknown. The solution in this case is 0,223(834) since it is the shortest sequence of characters.
0,22383483Output:
0,223(834)Explanation:
Let 0,223834863 be the notation of infinite decimal number with its end cut off. It can be noted as 0,223(834) or 0,2238(348) or 0,22(38348), because the rest of the number is unknown. The solution in this case is 0,223(834) since it is the shortest sequence of characters.
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.