E :: Palindromic Dates

Time Limit: 10 Seconds    Memory Limit: 65536 KB

A date is said to be palindromic if, when written in the form “YearMMDD”, the result is a palindrome (a number that has the same value regardless if we read it left-to-right or right-to-left).
For example, the date “January 1st, 1” is palindromic since it would be written as “10101”;
“December 1st, 1021” is palindromic too, since it would be written as “10211201”.
Given a date, you are required to find the next valid date (in chronological order) that is palindromic (according to the definition of “palindromic date” that was given in the previous paragraph). For the purpose of this problem, a date is considered valid if the year is between 1 and 2147483647, the month is between 1 and 12, the day is at least 1.

Input

The input file contains one date per line: thee numbers separated by the character ‘/’, representing (in order) the day, month and year. For example, July 4th 2011 would be written as “04/07/2011” (or 4/07/2011, or 4/7/2011). The last line in the input file is empty.
It is guaranteed that all input dates are valid, and that for all input dates there is a “next valid palindromic date”.

Output

The output file shall contain the next valid palindromic date for each date in the input file, one date per line. The date format in the output file is DD/MM/Year – i.e. the separator character is '/', the year’s first digit must never be 0, and you must always use two digits for day and month (use 01 instead of 1, 02 instead of 2 etc.).

Sample Input

1/1/1
12/11/1
01/06/138048967

Sample Output

01/02/1
11/12/1
31/08/138048984
Submit

Source: South Eastern European Regional Contest 2011