#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  int counter = 0;
  vector<int> idx;
  cin >> str;
  for (int i = 0; i < str.size() - 1; i++) {
    if (str.at(i) == str.at(i + 1)) {
      idx.push_back(i);
      i++;
      counter++;
    }
  }
  for (int i = 0; i < idx.size() - 1; i++) {
    if (str.at(idx.at(i)) == str.at(idx.at(i + 1))) {
      counter++;
    }
  }
  cout << str.size() - counter << endl;
}
