s = input() half = int(len(s) / 2) left_s = s[:half] right_s = s[half:] max_left = 1 max_right = 1 for i in set(left_s): max_left = max(max_left,left_s.count(i)) for i in set(right_s): max_right = max(max_right,right_s.count(i)) print(len(s) - max_left - max_right)