#include <bits/stdc++.h>
using namespace std;
using INT = long long;
using UINT = unsigned long long;
unsigned gcd(unsigned a, unsigned b) {
  while (1) {
    if (a < b) swap(a, b);
    if (!b) break;
    a %= b;
  }
  return a;
}
int main() {
  string s;
  cin >> s;
  int r = 1;
  auto t = s[0];
  int d = 1;
  for (size_t i = 1; i < s.length(); i++) {
    if (s[i] != t) {
      d *= -1;
      t = s[i];
    }
    r += d;
  }
  cout << (s.length() - r) << endl;
  return 0;
}
