CF2065B.Skibidus and Ohio

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Skibidus and Ohio

Skibidus is given a string ss that consists of lowercase Latin letters. If ss contains more than 11 letter, he can:

  • Choose an index ii (1is11 \leq i \leq |s| - 1, s|s| denotes the current length of ss) such that si=si+1s_i = s_{i+1}. Replace sis_i with any lowercase Latin letter of his choice. Remove si+1s_{i+1} from the string.

Skibidus must determine the minimum possible length he can achieve through any number of operations.

Input

The first line contains an integer tt (1t1001 \leq t \leq 100) — the number of test cases.

The only line of each test case contains a string ss (1s1001 \leq |s| \leq 100). It is guaranteed ss only contains lowercase Latin letters.

Output

For each test case, output an integer on the new line, the minimum achievable length of ss.

Note

In the first test case, Skibidus can:

  • Perform an operation on i=2i = 2. He replaces s2s_2 with b and removes s3s_3 from the string. Then, ss becomes bb.
  • Perform an operation on i=1i = 1. He replaces s1s_1 with b and removes s2s_2 from the string. Then, ss becomes b.
  • Because ss only contains 11 letter, Skibidus cannot perform any more operations.

Therefore, the answer is 11 for the first test case.

In the second test case, he cannot perform an operation on any index. Therefore, the answer is still the length of the initial string, 88.

Samples

4
baa
skibidus
cc
ohio
1
8
1
4

在线编程 IDE

建议全屏模式获得最佳体验