#K47712. Minimum Operations to Uniform String

    ID: 28260 Type: Default 1000ms 256MiB

Minimum Operations to Uniform String

Minimum Operations to Uniform String

Given a string \(s\) consisting of lowercase English alphabets, your task is to compute the minimum number of operations required to make all characters in the string identical. In one operation, you can choose any character and change it to any other lowercase English letter.

The optimal strategy is to determine the character that appears most frequently in \(s\). If the maximum frequency is \(f_{max}\) and the length of the string is \(|s|\), then the minimum number of operations required is \(|s| - f_{max}\). Use this formula to solve the problem.

inputFormat

The input comes from standard input (stdin) and consists of a single line containing the string (s), which is composed only of lowercase English alphabets.

outputFormat

Output to standard output (stdout) a single integer, representing the minimum number of operations required to make all characters in the string identical.## sample

aab
1