#C8523. Minimum Operations to Unify Characters
Minimum Operations to Unify Characters
Minimum Operations to Unify Characters
Given a string s
consisting only of characters 'a' and 'b', determine the minimum number of operations required to make all characters in the string identical. In each operation, you can change an 'a' to a 'b' or a 'b' to an 'a'.
Mathematically, if the number of 'a's is n_a and the number of 'b's is n_b, then the minimum operations required is: $$ \min(n_a, n_b) $$.
inputFormat
The input contains a single non-empty string comprised solely of the characters 'a' and 'b'.
outputFormat
Output the minimum number of operations required to unify all characters in the string. The result should be printed to stdout.
## sampleaaabbb
3