JDCC '16 Contest 1 P2 - Reddit at Work

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Problem type

Steve, an employee of Hooli Inc, is incredibly lazy. Whenever he can get away with it, he prefers to browse the internet rather than doing work. Unfortunately, Steve does not get this luxury when he is in meetings, as others would see that he isn't working.

Steve's boss knows of his work habits and as a result gives Steve lots of meetings in order to keep him productive. Given the times of Steve's meetings, can you help the boss figure out how much time Steve will be wasting?


A test case begins with an integer N (1 \le N \le 100), the number of meetings that Steve has scheduled for the day. The next N lines contain two times, the start and end time of a meeting.

Meetings are given in order of start time and two meetings will not start at the same time. Steve's work day is from 9am to 5pm, and he will not have any meetings scheduled outside of this time.


Output the time that Steve will waste on Reddit in the form (H:MM).

Sample Input

9:00 4:00
4:30 5:00

Sample Output


Sample Input

9:00 1:00
12:00 3:00
4:00 5:00

Sample Output



There are no comments at the moment.