#C13309. Time Difference Calculator

    ID: 42833 Type: Default 1000ms 256MiB

Time Difference Calculator

Time Difference Calculator

This problem requires you to compute the time difference between a start time and an end time provided in a 24-hour format. The times are given as 4-digit integers (e.g., 2300 represents 11:00 PM). If the end time is earlier than the start time, it is considered to be on the next day.

You are required to output the difference between the two times as hours and minutes in the following format:

{\text{hours}} hours and {\text{minutes}} minutes.

Note that the conversion from hours and minutes to total minutes can be expressed in the formula: $$\text{total minutes} = \text{hours} \times 60 + \text{minutes}.$$

Make sure your solution reads input from standard input (stdin) and writes the result to standard output (stdout).

inputFormat

The input consists of a single line containing two integers separated by a space:

  • start_time: A 4-digit integer representing the start time in 24-hour format.
  • end_time: A 4-digit integer representing the end time in 24-hour format.

If end_time is less than start_time, consider that end_time occurs on the next day.

outputFormat

Output a single line that displays the time difference in the format:

{hours} hours and {minutes} minutes.

Here, {hours} is the number of hours and {minutes} is the number of minutes in the computed time difference.

## sample
800 1230
4 hours and 30 minutes.