PROGRAMMING:Keven's assistance
There is a string of $$s $$composed of only three letters of $$a, B, C $.
$$Keven $$thinks that a string is good if and only if the first n characters of the string are all $$a $, the $$n + 1 $$bits to $$2 * n $$bits are all $$B $, and the $$2 * n + 1 $$bits to $$3 * n $$bits are all $$C $.
Please find the value of $$n $$of the substring in the given string $$s $$that satisfies the requirement of $$Keven $$.
The substring $$a $$of $$s $$is defined as the string $$s $$which continuously removes a number of (can be 0) characters from the beginning and a number of (can be 0) characters from the end. The resulting string (for example, bab is the substring of Ababa; bab is the substring of Ababa; bab is the substring of Ababa; bab is the substring of Ababa; BBA is not a substring of ABA)
###Input format:
The first line gives a positive integer $$t (1 < = T < = 100)$$
After the T line, each line gives a string $$s (1 < = | s | < = 10 ^ 4)$$
$$| S $$$represents the length of the string $$s $
###Output format:
For each group of inputs, output the maximum length of substring in one line.
###Input example:
Here is a set of inputs. For example:
```in
three
abc
aab
bcaabbcc
```
###Output example:
The corresponding output is given here. For example:
```out
one
0
two
```
###Tips:
10% data, $$1 < = | s < = 10$$
30% data, $$1 < = | s < = 10 ^ 2$$
50% of the data, $$1 < = | s < = 10 ^ 3$$
80% of the data, $$1 < = | s < = 10 ^ 4$$
For 100% of data, $$1 < = | s < = 10 ^ 5 $$< br > < br > < br > < br > < br > < br > is used
answer:If there is no answer, please comment
$$Keven $$thinks that a string is good if and only if the first n characters of the string are all $$a $, the $$n + 1 $$bits to $$2 * n $$bits are all $$B $, and the $$2 * n + 1 $$bits to $$3 * n $$bits are all $$C $.
Please find the value of $$n $$of the substring in the given string $$s $$that satisfies the requirement of $$Keven $$.
The substring $$a $$of $$s $$is defined as the string $$s $$which continuously removes a number of (can be 0) characters from the beginning and a number of (can be 0) characters from the end. The resulting string (for example, bab is the substring of Ababa; bab is the substring of Ababa; bab is the substring of Ababa; bab is the substring of Ababa; BBA is not a substring of ABA)
###Input format:
The first line gives a positive integer $$t (1 < = T < = 100)$$
After the T line, each line gives a string $$s (1 < = | s | < = 10 ^ 4)$$
$$| S $$$represents the length of the string $$s $
###Output format:
For each group of inputs, output the maximum length of substring in one line.
###Input example:
Here is a set of inputs. For example:
```in
three
abc
aab
bcaabbcc
```
###Output example:
The corresponding output is given here. For example:
```out
one
0
two
```
###Tips:
10% data, $$1 < = | s < = 10$$
30% data, $$1 < = | s < = 10 ^ 2$$
50% of the data, $$1 < = | s < = 10 ^ 3$$
80% of the data, $$1 < = | s < = 10 ^ 4$$
For 100% of data, $$1 < = | s < = 10 ^ 5 $$< br > < br > < br > < br > < br > < br > is used
answer:If there is no answer, please comment