Statement
Statement language
You are given a string of length . consists only of , , and .
In one operation, choose two adjacent different characters and delete both of them. The remaining parts are concatenated.
Repeat the operation until no operation is possible. Find the number of distinct strings that can remain. The empty string is also counted.
Input
The input is given from Standard Input in the following format:
Each case is given in the following format:
Output
For each test case, print the number of distinct possible final strings on one line.
Constraints
- .
- .
- is a string of length consisting only of , , and .
- The sum of over all test cases does not exceed .
Subtasks
Samples
Input
8
1
A
2
AB
3
ABC
4
AABC
5
AAABC
5
ACBAC
6
ABCABC
9
ABACABACA
Output
1
1
2
2
2
3
3
1