# Given two times when seen on a digital clock, count the number of moments between these two times… 1 answer below »

Given two times when seen on a digital clock, count the number of moments between these two times (both start and end time included) when the time was a palindrome.

A digital clock shows time in the format HH:MM:SS (hours:minutes:seconds).

For example, 2:40:38 pm is represented as 14:40:38.

### Input

The first line contains q queries.
This is followed by q lines each containing two time strings, t1 and t2, which are 6 digit integers that represent times shown by a digital clock. It is ensured that t1 and t2 are valid times.

### Output

• Each output on a new line.

### Constraints

• 1 = q = 105
• t1 and t2 are of the form HH:MM:SS
• t1 occurs on or before t2

### Example

Input: 4 00:00:01 00:00:01 09:09:09 13:34:57 11:11:11 11:11:11 02:38:15 03:01:16
Output: 0 22 1 3

### Explanation

Case 1: Only 1 moment is considered in this case, i.e., 00:00:01. We can clearly see that 00:00:01 is not a palindromic string.
Case 4: Between 02:38:15 and 03:01:16, there are 3 moments that are palindromic strings. They are 02:44:20, 02:55:20 and 03:00:30.

Note that the time as seen on a digital clock should appear as a palindrome. 1 is a palindrome, but 00:00:01 on a digital clock is not.