Problem: On Time for the Exam

A student has to attend an exam at a particular time (for example at 9:30 am). They arrive in the exam room at a particular time of arrival (for example 9:40 am). It is considered that the student has arrived on time, if they have arrived at the time when the exam starts or up to half an hour earlier. If the student has arrived more than 30 minutes earlier, the student has come too early. If they have arrived after the time when the exam starts, they are late.

Write a program that inputs the exam starting time and the time of student's arrival, and prints if the student has arrived on time, if they have arrived early or if they are late, as well as how many hours or minutes the student is early or late.

Input Data

Read the following four integers (one on each row) from the console:

  • The first row contains exam starting time (hours) – an integer from 0 to 23.
  • The second row contains exam starting time (minutes) – an integer from 0 to 59.
  • The third row contains hour of arrival – an integer from 0 to 23.
  • The fourth row contains minutes of arrival – an integer from 0 to 59.

Output Data

Print the following on the first row:

  • "Late", if the student arrives later compared to the exam starting time.
  • "On time", if the student arrives exactly at the exam starting time or up to 30 minutes earlier.
  • "Early", if the student arrives more than 30 minutes before the exam starting time.

If the student arrives with more than one minute difference compared to the exam starting time, print on the next row:

  • "mm minutes before the start" for arriving less than an hour earlier.
  • "hh:mm hours before the start" for arriving 1 hour or more earlier. Always print minutes using 2 digits, for example "1:05".
  • "mm minutes after the start" for arriving more than an hour late.
  • "hh:mm hours after the start" for arriving late with 1 hour or more. Always print minutes using 2 digits, for example "1:03".

Sample Input and Output

Input Output Input Output
9
30
9
50
Late
20 minutes after the start
16
00
15
00
Early
1:00 hours before the start
9
00
8
30
On time
30 minutes before the start
9
00
10
30
Late
1:30 hours after the start
14
00
13
55
On time
5 minutes before the start
11
30
8
12
Early
3:18 hours before the start
Input Output
10
00
10
00
On time
11
30
10
55
Early
35 minutes before the start
11
30
12
29
Late
59 minutes after the start

results matching ""

    No results matching ""