Mock CCC '18 Contest 3 J3/S1 - A String Problem

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 1G

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Given a string, determine the minimum number of characters that need to be deleted such that there are only one or two distinct letters remaining.


1 \le N \le 100

The string only consists of lowercase letters.

Input Specification

The input consists of a single string of length N.

Output Specification

Print, on a single line, the minimum number of characters to be deleted.

Sample Input


Sample Output


Sample Input


Sample Output



There are no comments at the moment.