题目描述
Read problems statements in Mandarin Chinese , Russian and Vietnamese as well.
Sergey recently learned about country codes - two letter strings, denoting countries. For example, BY stands for Belarus and IN stands for India. Mesmerized by this new discovery, Sergey now looks for country codes everywhere!
Sergey has recently found a string S consisting of uppercase Latin letters. He wants to find the number of different country codes that appear in S as contiguous substrings. For the purpose of this problem, consider that every 2-letter uppercase string is a valid country code.
------ Input ------
The first line of input contains an integer T denoting the number of test cases. The description of T test cases follows.
The first and only line of each test case contains a string S, consisting of uppercase Latin letters.
------ Output ------
For each test case, output a single line containing the number of different country codes appearing in the given string.
------ Constraints ------
$1 ≤ T ≤ 100$
$Subtask 1 (35 points): 2 ≤ |S| ≤ 3$
$Subtask 2 (65 points): 2 ≤ |S| ≤ 10^{4}$
----- Sample Input 1 ------
2
INBY
BYBY
----- Sample Output 1 ------
3
2
----- explanation 1 ------
Example case 1. The codes are IN, NB and BY.
Example case 2. The codes are BY and YB.
输入格式
见题面
输出格式
见题面