#K88062. Date Format Conversion

    ID: 37225 Type: Default 1000ms 256MiB

Date Format Conversion

Date Format Conversion

You are given a date string in the format \( dd-mm-yyyy \). Your task is to convert it to the format \( yyyy-mm-dd \). If the input date is not valid (either not conforming to the specified format or representing a non-existent date), output None.

Note: Use strict checking. For example, the input must contain exactly two dashes at positions 3 and 6, and the day, month, and year must form a valid calendar date. Leap year rules apply: A year is a leap year if it is divisible by 400, or if it is divisible by 4 but not by 100.

Example: For a correct input such as "25-12-2021", the output should be "2021-12-25"; for an incorrect input such as "32-01-2021", output None.

inputFormat

The input consists of a single line containing a date string in the format dd-mm-yyyy.

outputFormat

If the input date is valid, print the date in yyyy-mm-dd format. Otherwise, print None.

## sample
25-12-2021
2021-12-25