This page is still under construction.

Parts of this page are still being built. What you see may change.

Every Second Counts

Time limit2sMemory limit512 MB

Summary
Given a start and end clock time, compute how many seconds elapsed, adding 24 hours if the ride crosses midnight.
Level

Easy1 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

Meredith runs a taxi company called Ruber in the small towns of western Pennsylvania. She charges per second instead of per minute, so she needs the exact number of seconds between the moment a client enters a cab and the moment the client leaves it. Read the start time and the end time of one ride and compute the elapsed time in seconds.

Input

The first line contains the start time of a single taxi ride and the second line contains its end time. Both times use the form hh : mm : ss, where the hour, the minute and the second are separated by a colon surrounded by spaces. No value is padded with a leading zero. Meredith uses a 24 hour clock, so 0 : 0 : 0 is midnight and 23 : 59 : 59 is one second before midnight. If the ride spans midnight, the end time is smaller than the start time.

Output

Print the number of seconds between the two times on one line. No ride lasts 24 hours or longer. If the end time is smaller than the start time, the ride crossed midnight once. If the two times are equal, print 0.

Examples3

  1. Example 1

    Input
    10 : 0 : 0
    11 : 0 : 0
    
    Expected output
    3600
    
  2. Example 2

    Input
    13 : 30 : 52
    13 : 31 : 7
    
    Expected output
    15
    
  3. Example 3

    Input
    23 : 0 : 0
    1 : 30 : 0
    
    Expected output
    9000