Given a string consisting of the letters , and , we can perform the following operation:

- Take any two adjacent distinct characters and replace them with the third character.

Find the shortest string obtainable through applying this operation repeatedly.

For example, given the string we can reduce it to a character string by replacing with and with : .

**Function Description**

Complete the *stringReduction* function in the editor below. It must return an integer that denotes the length of the shortest string obtainable.

stringReduction has the following parameter:

- *s*: a string

**Input Format**

The first line contains the number of test cases .

Each of the next lines contains a string to process.

**Constraints**

**Output Format**

For each test case, print the length of the resultant minimal string on a new line.

**Sample Input**

```
3
cab
bcab
ccccc
```

**Sample Output**

```
2
1
5
```

**Explanation**

For the first case, there are two solutions: or .

For the second case, one optimal solution is: .

For the third case, no operations can be performed so the answer is .