#include <bits/stdc++.h>
using namespace std;
string s;
int removed;
inline void remove_cube(int k) { s.erase(s.begin() + k), removed++; }
int main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr),
      cin >> s;
  for (int m = s.size() - 1, j = m, i = j - 1; i >= 0; j = i--)
    if (s[i] != s[j]) remove_cube(j), remove_cube(i);
  cout << removed;
}
