#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (n == 2) {
    if (s[0] == s[1]) {
      cout << 1 << endl;
      return 0;
    } else {
      cout << 2 << endl;
      return 0;
    }
  }
  int ans = 1;
  string t = s[0] + "";
  for (int i = 1; i < n; i++) {
    if (i == n - 1) {
      ans++;
      break;
    }
    if (i == n - 2) {
      if (t == s[i] + "") {
        ans++;
        break;
      } else {
        if (s[i] == s[i + 1]) {
          ans++;
          break;
        } else {
          ans += 2;
          break;
        }
      }
    }
    if (t != s[i] + "") {
      t = s[i] + "";
      ans++;
    } else {
      t = "" + s[i] + s[i + 1];
      i++;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
