The exam season at the University of Zagreb is over and students are doing what they love the most – sleeping. In the rare moments of wakefulness, they usually scroll over their Instagram feed. Fabijan is one of those students.
Recently, he read the following caption – the date 02.02.2020.
is the first
palindromic date in the last
He realized the caption was incorrect and this made him wonder about palindromic dates so he asked himself for each of the 02.02.2020.
and 12.10.0121.
are palindromic, while 03.02.2020.
and 12.07.1993.
are not.
Note: In this task it is important to take account of leap years which have
Input
The first line contains an integer
The next DD.MM.YYYY.
.
Output
For each date from the input, you should output the first palindromic date that comes strictly after it.
That date should be printed in the DD.MM.YYYY.
and we guarantee that the solution exists in this format.
Scoring
In the test cases worth a total of
In the test cases worth an additional
In the test cases worth an additional
Sample Input 1
1
02.02.2020.
Sample Output 1
12.02.2021.
Explanation of Sample Output 1
Although the given date is palindromic, Fabijan is interested in
the first date that strictly comes after it. That date is 12.02.2021.
.
Sample Input 2
2
01.01.1000.
31.12.2026.
Sample Output 2
10.01.1001.
03.02.2030.
Sample Input 3
3
01.01.0100.
05.07.0321.
05.05.0505.
Sample Output 3
10.10.0101.
10.01.1001.
10.01.1001.
Comments