#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long long size = ((long long)(s).size());
  for (int j = 0; j < size; j++) {
    string t;
    long long new_size = ((long long)(s).size());
    for (int i = 0; i < new_size; i++) {
      if (i == new_size - 1) {
        t += s[i];
        break;
      }
      if (s[i] != s[i + 1]) {
        i++;
        continue;
      }
      t += s[i];
    }
    if (((long long)(s).size()) == ((long long)(t).size())) {
      break;
    }
    s = t;
  }
  cout << size - ((long long)(s).size());
  return 0;
}
