#include <bits/stdc++.h>
using namespace std;
signed main() {
  string a;
  cin >> a;
  long long b = a.size();
  long long c;
  for (long long j = 0; j < 1000000; ++j) {
    for (long long i = 0; i < a.size() - 1; ++i) {
      if (a.at(i) == a.at(i + 1)) {
        a.replace(i, 2, "");
        i--;
      }
      if (a.size() == i + 1) break;
    }
    if (c == a.size()) break;
    c == a.size();
  }
  cout << b - a.size();
}
