import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextLine()) {
            String str = in.nextLine();
            if(str.length()%2!=0){
                return;
            }
		  //前半部分吧
            char[] c1 = str.substring(0,(str.length()/2)).toCharArray();
		  //后半部分
            char[] c2 = str.substring(str.length()/2).toCharArray();
            HashMap<Character,Integer> map1 = new HashMap<Character,Integer>();
            HashMap<Character,Integer> map2 = new HashMap<Character,Integer>();
            int max1 = 0;
            int max2 = 0;
		  //获取每个字母出现的次数,同时在循环中比较得出最大的值
            for(char c :c1){
                map1.put(c,map1.getOrDefault(c,0)+1);
                max1 = Math.max(max1,map1.get(c));
            }
            for(char c :c2){
                map2.put(c,map2.getOrDefault(c,0)+1);
                max2 = Math.max(max2,map2.get(c));
            }
		  //最大的值即是我们要保留的字符,需要改变的字符为原字符串长度-max1-max2;
            System.out.println(str.length()-max1-max2);
        }
    }
}