P13745 [CodeChef] psudo1
NOI
题目描述

Chef is all ready to show his new dish at the restaurant but he is very scared if the people dislike it. He wants to show them his dish at a perfect time, so that all may like the dish.
If the time displayed as HH:MM, where HH is the hour and MM is the minute then, for the Chef's time to be lucky it should be of the format XY:YX, XY:XY or XX:YY, in which X and Y show occurrence of same number. Here X and Y can be same.
An assistant of Chef gives him a string of possible perfect times separated by space, you have to help Chef to determine what is the number of perfect times in the given string.

Input
First line of input will consist of number of test cases t.
The subsequent t lines will consist of a string of possible perfect times in the format HH:MM where HH is hours and MM is minutes, separated by a space

Output
For every input, output will be a single line, containing the number of Perfect Times in the string

Constraints

1 ≤ t ≤ 500
00 ≤ HH ≤ 23
00 ≤ MM ≤ 59
There can be 1 to 50 (both inclusive) possible perfect times given in a string

Example
Input:
2
12:21 11:10
06:00

Output:
1
0

输入格式

见题面

输出格式

见题面

样例输入
2 12:21 11:10 06:00
样例输出
1 0