#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans(0);
  for (int i = 0; i < s.length(); i++) {
    int g = i + 1, j = i;
    while (g < s.length() && s[j] != s[g]) {
      g++;
      j++;
    }
    if (j != i) {
      ans++;
      s.erase(i, j - i + 1);
      i = -1;
    } else
      i = g - 1;
  }
  cout << ans;
}
