﻿ Fuzhou University OnlineJudge ﻿

## Problem Description

argentmoon loves sleeping. After days of oversleeping, he bought a clock yesterday.

Unfortunately, he was late again today. “God, it’s working at a wrong time”, he suddenly find the problem. What a poor man!

In order to avoid oversleeping, he begins to adjust the clock...

Look at the clock above, he can adjust the clock’s hour, minute, second separately by increasing or decreasing one unit once. the hour’s range is in 0~23, with the miniute and second both in 0~59, changes circularly.

When the second increases a unit from 59 to 0, the minute will increase a unit automatically. When the second decreases a unit from 0 to 59, the minute will decrease a unit automatically.

When the minute increase a unit from 59 to 0, the hour will increase a unit automatically. When the minute decrease a unit from 0 to 59, the hour will decrease a unit automatically.

Now, given the initial time and the right time, can you tell him how many units does he need to adjust at least.

## Input

The input will contain several test cases. Each testcase is a single line with two words, separated by a single space.the words are in the format of “HH:MM:SS”, denote the initial time and the right time separately.

## Output

For each test case output the minimum unit he need to adjust.

## Sample Input

01:01:01 12:12:12 23:59:59 00:00:00

33 1

## Source

FZU 2007 ICPC Qualification Round I

Submit  Back  Status  Discuss
﻿