#include <bits/stdc++.h>
using namespace std;
int a, b, c, d, ans, cou;
vector<int> o;
string s;
int main() {
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    o.push_back(s[i] - '0');
    cou++;
  }
  if (o.size() == 1) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < o.size(); i++) {
    if (o[i] != o[i + 1]) {
      o.erase(o.begin() + i);
      o.erase(o.begin() + i);
      i = -1;
    }
  }
  cout << cou - o.size() << endl;
}
