#K38762. Calculate Duration in Seconds
Calculate Duration in Seconds
Calculate Duration in Seconds
You are given two time stamps in the format HH:MM:SS
. Your task is to compute the duration between the two times in seconds. The first time is the start time and the second is the end time. The duration is computed as the difference between the total number of seconds up to the end time and the total number of seconds up to the start time.
Mathematically, if \( h, m, s \) represent hours, minutes, and seconds respectively, then the total seconds from a given time is computed as:
$$\text{total seconds} = h \times 3600 + m \times 60 + s $$The answer is the difference between the total seconds at the end time and the total seconds at the start time.
Example: Given 12:30:15
as the start time and 14:45:30
as the end time, the duration is calculated as:
inputFormat
The input consists of two lines. The first line contains the start time and the second line contains the end time, both formatted as HH:MM:SS
.
outputFormat
Output a single integer representing the duration in seconds between the start and end times.
## sample12:30:15
14:45:30
8115