#C6256. Minimum Operations to Uniform String

    ID: 49996 Type: Default 1000ms 256MiB

Minimum Operations to Uniform String

Minimum Operations to Uniform String

You are given a string (S) consisting only of the characters 'a', 'b', and 'c'. The task is to determine the minimum number of operations required to make all characters in (S) identical. In one operation, you can change any one character to any other character from the set ({'a', 'b', 'c'}). Mathematically, the answer is given by [ |S| - \max(\text{count}(a),, \text{count}(b),, \text{count}(c)) ] where (|S|) is the length of the string and (\text{count}(x)) is the number of times character (x) appears in (S). Note that if the string is empty, the output is 0.

inputFormat

The input consists of a single line containing the string (S), which may possibly be empty.

outputFormat

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

abc
2