-->
当前位置:首页 > 题库

PROGRAMMING:Date identification 1

Luz5年前 (2021-05-10)题库454
###Task description
```
Student x is very upset recently, because he is worried about a lot of date data. The reason is that the date writing is extremely nonstandard, and he can't recognize the day without careful identification.
For the following three numbers in each date, the location of month, year and day is uncertain. Suppose that the largest number represents the year, the number in the range of 1-12 represents the month, and the number in the range of 1-31 represents the date. If the range of month and day is all 1-12, it will be identified in the order of the previous month and the following day.
For example:
2 / 3-123 is identified as February 3, 0123, which is legal;
13 + 12 + 45 is recognized as December 13, 0045, which is legal;
12 = 3 = 13, identified as December 3, 0013, legal;
29, 22019 is identified as February 29, 2019, which does not exist and is illegal;
12@12#12 Identified as December 12, 0012, legal;
35.36.37 identified as XX, XX, 0037, XX is beyond the range of month and date, which is illegal;
11 * 30 * 30 is recognized as November 30, 0030, which is legal;
Now X has to program to judge whether those dates are legal. Do you think he can compile them.
```
###Input format:
One line, a date in the form of X-Y-Z, where x, y and Z are positive integers with no more than 4 digits, and "-" is a separator character, which may be any symbol.
###Output format:
If the date is a legal date, the normative expression of the date is output in the form of "yyyy-mm-dd", with 4 digits of year and 2 digits of month and day, which is less than 0.
If the date is illegal, output: invalid date!.
###Input example:
```in
25-30-5
```
###Output example:
```out
0030-05-25
```
###Input example:
```in
2019-32-09
```
###Output example:
```out
Invalid Date!
```
###Input example:
```in
2019-30-09
```
###Output example:
```out
2019-09-30
```







answer:If there is no answer, please comment