#K49782. Calculate Event Duration

    ID: 28719 Type: Default 1000ms 256MiB

Calculate Event Duration

Calculate Event Duration

You are given the start time and end time of an event in a 24-hour clock format (HH:MM). Your task is to calculate the duration of the event. If the end time is later than or equal to the start time, you can directly compute the difference. Otherwise, assume the event ends on the next day. In mathematical terms, if (T_s) is the start time (in minutes) and (T_e) is the end time (in minutes), then the duration (D) (in minutes) is given by:

[ D = \begin{cases} T_e - T_s, & \text{if } T_e \geq T_s \ (24 \times 60 - T_s) + T_e, & \text{if } T_e < T_s \end{cases} ]

Finally, convert the duration from minutes to hours and minutes and output the result in the format "X hour(s) and Y minute(s)".

inputFormat

The input consists of two lines. The first line contains the start time in HH:MM format, and the second line contains the end time in HH:MM format.

outputFormat

Output a single line representing the duration of the event in the format "X hour(s) and Y minute(s)".## sample

14:40
16:20
1 hour(s) and 40 minute(s)