#include <bits/stdc++.h>
using namespace std;
int main() {
  string homu;
  cin >> homu;
  int n = homu.size();
  while (1) {
    bool ok = false;
    for (int i = 0; i < (int)homu.size(); ++i) {
      if (i + 1 < homu.size() && homu[i] != homu[i + 1]) {
        homu = homu.substr(0, i) + homu.substr(i + 2);
        ok = true;
        break;
      }
    }
    if (!ok) break;
  }
  cout << n - homu.size() << endl;
  return 0;
}
