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

PROGRAMMING:Date identification 3

Luz5年前 (2021-05-10)题库519
###Task description
```
Unfortunately, Yu Long always has a problem with dates recently, because he is faced with a lot of date data at a time. This time, the reason is that the writing of those dates is extremely nonstandard, and it's impossible to recognize the day when we carefully distinguish them, because many dates can be understood as a variety of situations.
The location of the three numbers in each of the following dates is uncertain, which leads to various understandings. For example:
2 / 3 / 1 can be understood as 0002-03-01 or 0003-02-01 or 0001-02-03;
13 + 12 + 45 can only be understood as 0045-12-13;
12 = 3 = 13 can be understood as 0012-03-13 or 0002-12-13 or 0013-12-03 or 0013-03-12;
29, 22019 are not legal dates;
35.36.37 is not a legal date;
11 * 31 * 30 can be understood as 0031-11-30;
11 * 31 * 11 can be understood as 0011-11-30;
5 * 5 * 5 can be understood as 0005-05-05;
5 * 6 * 6 can be understood as 0005-06-06, 0006-06-05 and 0006-05-06;
13-13-5 can be understood as 0013-05-13;
5-5-13 can be understood as 0013-05-05 and 0005-05-13;
Now Yu Long wants to program to judge whether those dates can be understood as legal dates. 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.
Note: this test data does not guarantee that x, y, Z are different.
```
###Output format:
```
If the date can be understood as a legal date, first output the number of legal dates it can be understood as, and then output these legal dates in the order from back to front;
If the date cannot be interpreted as a legal date, output: invalid date!.
```
###Input example:
```in
2/3/1
```
###Output example:
```out
six
0003-02-01
0003-01-02
0002-03-01
0002-01-03
0001-03-02
0001-02-03
```
###Input example:
```in
13+12+45
```
###Output example:
```out
one
0045-12-13
```
###Input example:
```in
29,2,2019
```
###Output example:
```out
Invalid Date!
```
###Input example:
```in
35-36-37
```
###Output example:
```out
Invalid Date!
```
###Input example:
```in
11-30-31
```
###Output example:
```out
one
0031-11-30
```
###Input example:
```in
5-5-13
```
###Output example:
```out
two
0013-05-05
0005-05-13
```
###Input example:
```in
5-5-6
```
###Output example:
```out
three
0006-05-05
0005-06-05
0005-05-06
```
###Input example:
```in
4-2-28
```
###Output example:
```out
four
0028-04-02
0028-02-04
0004-02-28
0002-04-28
```
###Input example:
```in
5*5*5
```
###Output example:
```out
one
0005-05-05
```






answer:If there is no answer, please comment