#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  string al = "abcdefghijklmnopqrstuvwxyz";
  vector<char> v;
  for (int j = 0; j < S.size(); j++) {
    v.push_back(S[j]);
  }
  bool update = true;
  while (update) {
    vector<char> w;
    update = false;
    int i = 0;
    while (i < v.size()) {
      if (v[i] == v[i + 1]) {
        i = i + 2;
        update = true;
        continue;
      }
      if (i < v.size() - 2 && v[i] == v[i + 2]) {
        i = i + 3;
        update = true;
        continue;
      }
      w.push_back(v[i]);
      i = i + 1;
    }
    v.clear();
    v = w;
    w.clear();
  }
  cout << v.size() << endl;
  return 0;
}
