# Read before proceeding to the solution:
# Overall logic:
# Given that the given string s has an even number of letters, we know
# that the final string s' should be formed by combining two substrings
# that consist of the same letter. This implies that we can solve this
# problem by splitting the input string in halves, and then identify the
# letter with most occurrences in the substrings. Taking the difference
# (dif) between the length of the halved-string and the number of
# occurrences of the target letter will give us the answer for the
# substring in question. The final answer will be (dif_1 + dif_2).
# Solution:
s = input()
# Write a function that identifies the letter with the highest
# number of occurrences in a string and returns its number of
# occurences:
def max_occ(s):
counts = {}
for letter in s:
if letter in counts:
counts[letter] += 1
else:
counts[letter] = 1
max_count = max(counts.values())
return max_count
def min_chg(s):
hlf_len = int(len(s)/2)
first_hlf = s[0:hlf_len]
second_hlf = s[hlf_len:]
first_hlf_chg = hlf_len - max_occ(first_hlf)
second_hlf_chg = hlf_len - max_occ(second_hlf)
num_chg = first_hlf_chg + second_hlf_chg
return num_chg
print(min_chg(s))