#K64482. Validating 12-Hour Time Format

    ID: 31985 Type: Default 1000ms 256MiB

Validating 12-Hour Time Format

Validating 12-Hour Time Format

You are given a string representing a time. The time is expected to be in a valid 12-hour format:

  • The format is HH:MM AM or HH:MM PM.
  • Here, \(HH\) denotes the hour and should be an integer between 01 and 12, inclusive.
  • \(MM\) denotes the minutes and should be an integer between 00 and 59, inclusive.
  • The separator between hours and minutes must be a colon ':' and there must be a space between the minutes and the period.

Your task is to determine whether the given string is a valid time in 12-hour format. Print Valid if it is, or Invalid otherwise.

inputFormat

The input consists of a single line containing a string time_str representing the time in 12-hour format.

Example: 02:30 PM

outputFormat

Output a single line: Valid if the time is in valid 12-hour format, otherwise Invalid.

## sample
02:30 PM
Valid

</p>