import java.io.*; import java.util.*; import java.awt.geom.*; /** * Solution to Simplicity * * @author vanb */ public class simplicity_vanb { public Scanner sc; public PrintStream ps; /** * Driver. * @throws Exception */ public void doit() throws Exception { sc = new Scanner( System.in ); ps = System.out;; char letters[] = sc.next().trim().toCharArray(); int counts[] = new int[26]; Arrays.fill( counts, 0 ); // Count the occurrences of each letter, // mapping a to 0, b to 1, ..., y to 24, z to 25 for( char letter : letters ) { ++counts[(int)(letter-'a')]; } // Sort'em! Arrays.sort( counts ); int sum = 0; // The answer is the sum of all but the two biggest. // So, we'll add up 0..23, and skip 24 and 25 for( int i=0; i<24; i++ ) { sum += counts[i]; } ps.println( sum ); } /** * @param args */ public static void main( String[] args ) throws Exception { new simplicity_vanb().doit(); } }