Article directory
topic description
The definition string is completely composed of 'A' and 'B', of course, it can also be all 'A' or all 'B'. If the strings are arranged in lexicographical order from front to back, then we call them strictly increasing strings.
Given a string s, it is allowed to modify any character in the string, that is, any 'A' can be changed to 'B', and any 'B' can be changed to 'A', so that s can satisfy
strict The minimum number of modifications to increment.
0 < length of s < 100000.
enter description
Enter a string: "AABBA"
output description
Output: 1
Example
enter | THE FATHER |
output | 1 |
illustrate | Modify the last digit to get AABBB. |
topic analysis
When the character is B, count the number countB directly. (Assuming that the previous substring has been modified to meet the requirements, the B at the current position will not cause the dictionary