#K3816. Minimum Changes to Make String Identical

    ID: 26137 Type: Default 1000ms 256MiB

Minimum Changes to Make String Identical

Minimum Changes to Make String Identical

You are given a string s consisting solely of the characters 'A' and 'B'. Your task is to determine the minimum number of character changes required to make all characters in the string identical. In other words, you need to transform the string into one of the forms AAAA... or BBBB... by changing some of its characters.

The answer is given by the formula:

min(count(A), count(B))\min(\text{count}(A),\ \text{count}(B))

where count(A) denotes the number of 'A' characters in the string, and count(B) denotes the number of 'B' characters.

inputFormat

The input consists of a single line which contains the string s. The string will only include characters 'A' and 'B'.

outputFormat

Output a single integer representing the minimum number of changes required to make all the characters in the string identical.

## sample
ABBABA
3