#P8651. [蓝桥杯 2017 省 B] 日期问题

[蓝桥杯 2017 省 B] 日期问题

Problem Description

Xiaoming is organizing a batch of historical documents. Many dates appear in these documents. Xiaoming knows that these dates are all between January 1, 1960 and December 31, 2059.

What troubles Xiaoming is that the date formats are not consistent: some use year/month/day, some use month/day/year, and some use day/month/year. Even worse, the first two digits of the year are omitted, which means a single written date in the document may correspond to many possible actual dates.

For example, 02/03/04 could mean March 4, 2002; February 3, 2004; or March 2, 2004.

Given a date from the document, can you help Xiaoming determine which actual dates it could represent?

Input Format

A date in the form AA/BB/CC. (0A,B,C90\le A, B, C\le 9)

Output Format

Output several distinct dates, one per line, in the form yyyy-MM-dd. Sort the dates from earliest to latest.

02/03/04
2002-03-04  
2004-02-03  
2004-03-02  

Hint

Translated by ChatGPT 5