#K86182. Unique Character Replacement
Unique Character Replacement
Unique Character Replacement
Given a string S consisting of lowercase English letters, determine the minimum number of replacement operations needed such that all characters in the string become unique. In one replacement, you can change a character to any other lowercase letter ('a'-'z') that does not already appear in the string.
The mathematical formulation is given by: $$\text{replacements} = |S| - \text{unique}(S)$$, where \(|S|\) is the length of the string and \(\text{unique}(S)\) is the number of distinct characters in S.
You can assume that the resulting string is always achievable as long as the length of S does not exceed 26.
inputFormat
The input is provided via standard input (stdin) and contains a single line with the string S. The string S contains only lowercase English letters.
outputFormat
Print a single integer to standard output (stdout) representing the minimum number of replacements required to make all characters in S unique.
## sampleaabbcc
3