#C8049. Extract Hours from Time Range
Extract Hours from Time Range
Extract Hours from Time Range
You are given a time range in the format \(\texttt{HH:MM-HH:MM}\). Your task is to extract all the hours starting from the hour in the first time up to (and including) the hour in the second time. Each hour should be printed in the format \(\texttt{HH:00}\).
Note that the input must strictly follow the format. In particular, both times must be exactly 5 characters long (e.g. "09:00" rather than "9:00"). Also, the ending hour must not be less than the starting hour, and both hours should lie within \(\{00, \ldots, 23\}\). If the input is invalid, output undefined
.
inputFormat
A single line string that represents the time range in the format \(\texttt{HH:MM-HH:MM}\).
outputFormat
If the input is valid, output a single line with the extracted hours separated by a space, where each hour is formatted as \(\texttt{HH:00}\). Otherwise, output undefined
.
13:00-15:00
13:00 14:00 15:00