#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string st;
  cin >> st;
  vector<int> arr;
  int cnt = 0;
  int prev = 2;
  for (int i = 0; i < (st.size()); ++i) {
    arr.push_back(i);
    if (prev == 2) {
      prev = 1;
      cnt++;
    } else {
      if (prev == 1 && st[i] == st[i - 1]) {
        prev = 2;
        cnt++;
        i++;
      } else {
        prev = 1;
        cnt++;
      }
    }
  }
  if (!(prev == 2 && (int)arr.size() >= 2 &&
        arr[(int)arr.size() - 2] + 1 == arr[(int)arr.size() - 1] &&
        st[(int)st.size() - 1] == st[(int)st.size() - 2])) {
    cout << cnt;
    return 0;
  }
  cnt = 1;
  prev = 2;
  for (int i = (2); i < ((int)st.size()); i++) {
    if (prev == 2) {
      prev = 1;
      cnt++;
    } else {
      if (prev == 1 && st[i] == st[i - 1]) {
        prev = 2;
        cnt++;
        i++;
      } else {
        prev = 1;
        cnt++;
      }
    }
  }
  cout << cnt;
  return 0;
}
