Dates
InterviewTime limit1sMemory limit512 MB
Each input line is a date in day.month.year or month/day/year format; print both formats, validating that the date actually exists.
- Level
Easy3 of 10
- Topics
- Implementation, String, Math, Simulation
- Solved
- No attempts yet
Problem
One of the problems in dates processing is that there are several formats of writing down dates.
Peter has the task to write a program that processes an array of texts. Some of them have Russian and European format "day.month.year", while others use American format --- "month/day/year".
Here, year is a number from 1 to 9999, which may contain leading zeroes to get 2, 3 or 4 digits, month --- number from 1 to 12, which may contain leading zero to get 2 digits, day --- number from 1 to 31, which may contain leading zeros to get 2 digits. Dates can be incorrect (for example there can be "Since 2001 isn't a leap year, that's why 29.02.2001 --- incorrect date").
You've got an array of Peters' strings, which correspond to dates. Print each date in two formats: first as "DD.MM.YYYY', second as "MM/DD/YYYY".
Input
The first line of input contains one integer ().
Each of the following lines contain one date in format "day.month.year" or "month/day/year".
Output
Print lines. Each line should contain the date in two formats: first as "DD.MM.YYYY", second as "MM/DD/YYYY".