#include <iostream>
#include <string>
using namespace std;

int main() {
  string S;
  while (cin >> S) {
    pair<int, int> dyn = {0, 1000000};
    for (int i = 0, j = S.size()-1; i < j; i++, j--) {
      if (S[i] == S[j]) {
        dyn = {min(dyn.first, dyn.second+1), dyn.second+1};
      } else {
        dyn = {dyn.second, min(dyn.first+1, dyn.second+1)};
      }
    }
    cout << min(dyn.first, dyn.second) << endl;
  }
}
