#C5867. Date Format Checker for the Kingdom of Xyzzy
Date Format Checker for the Kingdom of Xyzzy
Date Format Checker for the Kingdom of Xyzzy
In the Kingdom of Xyzzy, dates are written in the format (DD-MM-YYYY). Your task is to determine if a given string represents a valid date in this format. A valid date must satisfy the following constraints:
- The date string must be exactly 10 characters long.
- The 3rd and 6th characters must be hyphens (-).
- The day ((DD)) should be a number between 1 and 31 (inclusive).
- The month ((MM)) should be a number between 1 and 12 (inclusive).
- The year ((YYYY)) should be a positive number (greater than 0).
- All characters representing day, month, and year must be digits.
Your solution should read a single line from standard input and print (Yes) if the date is valid or (No) otherwise.
inputFormat
A single line containing the date string in the format (DD-MM-YYYY).
outputFormat
Print a single line to standard output: (Yes) if the date format is valid, otherwise (No).## sample
12-05-2021
Yes
</p>