#K47857. Valid Date Checker

    ID: 28291 Type: Default 1000ms 256MiB

Valid Date Checker

Valid Date Checker

Given a date string in the format MM-DD-YYYY, determine whether it represents a valid date.

The month should be between 01 and 12, and the day must be within the valid range for the given month. February has 28 days in non-leap years and 29 days in leap years.

A year is considered a leap year if it satisfies the condition $$\text{(year \% 4 == 0 and year \% 100 \neq 0) or (year \% 400 == 0)}$$. Only dates that satisfy all the constraints are valid.

inputFormat

The first line contains an integer T, representing the number of test cases. Each of the following T lines contains a date string in the format MM-DD-YYYY.

outputFormat

For each test case, output a single line containing either "True" if the date is valid or "False" if it is not.## sample

1
12-31-2020
True

</p>