#C3854. Valid Date Checker

    ID: 47327 Type: Default 1000ms 256MiB

Valid Date Checker

Valid Date Checker

Given a date string in the format YYYY-MM-DD, determine if it represents a valid calendar date. The date string must strictly follow this format: four digits for the year, two for the month and two for the day. Moreover, the day must be correct for the given month, with special attention paid to February and leap years.

A year is considered a leap year if it satisfies the condition:

$$\Bigl((year\ \%\ 4 = 0 \wedge year \ \%\ 100 \neq 0) \vee (year \ \%\ 400 = 0)\Bigr)$$

For example:

  • 2020-02-29 is valid (2020 is a leap year).
  • 2019-04-31 is invalid (April has only 30 days).
  • 2100-02-29 is invalid (2100 is not a leap year).

Your task is to write a program that reads a date string from standard input and prints True if the date is valid, or False otherwise.

inputFormat

The input consists of a single line containing a date string in the YYYY-MM-DD format.

outputFormat

Output True if the provided date is valid; otherwise, output False.

## sample
2020-02-29
True