HANDS - Clock Hands

The minute hand and hour hand love each other. The ‘Second’ hand is a spy who wants to keep track on how many times they pass over each other in a given interval on a day. Help the second hand.

Input

First line contains the number of test cases t. Each test case has two lines representing the start time and end time respectively. The time would be in format (hh:mm). hh will be between 00 and 23, mm will be between 00 and 59. If the minute and hour hand are overlapping right at the start time (like at 12:00) then it would not be counted. (00:00 <= 'start time' < 'end time' <= 23:59)

Output

For each test case print, on a separate line, the number of times they overlap each other.

Example

Input:
5
00:00
03:00

00:00
00:10

06:00
12:00

11:59
12:01

00:00
12:00

Output:
2
0
6
1
11

Added by:Nikunj Jain
Date:2011-06-17
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Own Problem

hide comments
2016-04-12 00:40:00
Note to anyone solving this: Every test case contains 2 lines with the timestamps and one empty line afterwards. Take care of the empty line if you want your solution to be accepted!
2015-08-15 14:51:47 shantanu tripathi
nice one.. :) bad day.. wrong approach first attmpt..causd me 5WA
2015-07-10 15:45:01 chin
AC at first attempt!!!..:D Easy one!!..
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.