#C13906. Date Analysis
Date Analysis
Date Analysis
You are given a string that may contain dates in two distinct formats: (MM/DD/YYYY) and (DD-MM-YYYY). Your task is to extract all valid dates from the input and count how many valid dates appear in each format. A date is considered valid only if it represents a real calendar date, taking into account the number of days in each month and leap years. In addition, any date with the year 0000 is considered invalid. The valid dates should be output in the order in which they appear in the text.
inputFormat
A single line string is provided via standard input. The string may contain arbitrary text and potential date mentions following the formats (MM/DD/YYYY) or (DD-MM-YYYY).
outputFormat
Print two lines to standard output. The first line should list the valid dates found, separated by a single space. If no valid dates are found, output an empty line. The second line must contain two integers separated by a single space: the first integer is the count of valid dates in the (MM/DD/YYYY) format and the second is the count in the (DD-MM-YYYY) format.## sample
Here are some dates: 12/24/2020, 25-12-2020.
12/24/2020 25-12-2020
1 1
</p>