Under construction

Still being built. Things may change

Clock

Time limit2sMemory limit1024 MB

Summary
Given a start and end time on a 12-hour dial, count how many times the minute hand overtakes the hour hand in that interval, endpoints included.
Level

Medium4 of 10

Topics
Math, Implementation
Solved
No attempts yet

Statement

Eeyore got a wristwatch with hour and minute hands for his birthday. Now he has a new pastime: watching the hands move. He sees the minute hand catch up with the hour hand, pass it, and then keep running ahead.

This time Kanga caught Eeyore at it. She joined in, and after a while she wondered how many times Eeyore had seen the minute hand overtake the hour hand. She asked Eeyore when he had started watching the clock, wrote that down along with the current time, and ran off to Owl with the question. But Owl was very busy, so she asked you to help.

In one day the hour hand makes two turns, and the minute hand makes 2424 turns.

Input

The first line contains the time when Eeyore started watching the clock, in the format HH:MM. The first two digits are the hours, and the two digits after the colon are the minutes. The second line contains the end time in the same format.

Eeyore watched the clock for less than a day, but he could have been watching at midnight.

Output

Print a single integer: the number of moments during the observation when the minute hand overtakes the hour hand.

If an overtake happened at the moment Eeyore started or finished watching, it also counts.

Examples2

  1. Example 1

    Input
    23:50
    00:20
    
    Expected output
    1
    
  2. Example 2

    Input
    12:00
    13:20
    
    Expected output
    2