const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void (async function () {
// Write your code here
let line = await readline();
console.log(getDouble(line));
})();
function getDouble(str) {
const frontMap = {};
const endMap = {};
for (let i = 0; i < str.length / 2; i++) {
frontMap[str[i]] = frontMap[str[i]] ? frontMap[str[i]] + 1 : 1;
}
for (let i = str.length / 2; i < str.length; i++) {
endMap[str[i]] = endMap[str[i]] ? endMap[str[i]] + 1 : 1;
}
const frontKeys = Object.keys(frontMap)
const endKeys = Object.keys(endMap)
if (frontKeys.length === 1 && endKeys.length === 1) return 0
let max = 0
let result = 0
for (const key of frontKeys) {
max = frontMap[key] > max ? frontMap[key] : max
}
result += str.length / 2 - max
max = 0
for (const key of endKeys) {
max = endMap[key] > max ? endMap[key] : max
}
result += str.length / 2 - max
return result
}