#C14994. Determine the Day of the Week

    ID: 44704 Type: Default 1000ms 256MiB

Determine the Day of the Week

Determine the Day of the Week

You are given a date in the format \(YYYY-MM-DD\). Your task is to write a program that calculates the day of the week corresponding to the given date. The program must verify that the input is in the correct format and represents a valid date considering leap years. If the input is invalid, output an error message exactly as follows:

Input date must be in the format YYYY-MM-DD and be a valid date.

For a valid date, the program should print the full name of the day in English (e.g. Monday, Tuesday, etc.).

Note: The input date is given as a single string through standard input and the output should be printed to standard output.

inputFormat

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

outputFormat

If the input date is valid, output the corresponding day of the week (one of: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday). If the date is invalid (wrong format or invalid date), output Input date must be in the format YYYY-MM-DD and be a valid date.

## sample
2023-10-26
Thursday