#include <bits/stdc++.h>
using namespace std;
const int mod = (int)(1e9) + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  int n = s.length(), dp[100000];
  dp[0] = 1;
  dp[1] = dp[0] + (s[0] != s[1]);
  int stat = dp[1] == 1 ? 2 : 1;
  for (int i = 2; i <= n; i++) {
    dp[i] = dp[i - 1];
    if (s[i] != s[i - 1])
      dp[i]++;
    else if (dp[i - 1] != dp[i - 2]) {
      if (stat == 2) {
        dp[i]++;
        stat = 1;
      } else {
        stat = 2;
      }
    } else if (dp[i - 1] == dp[i - 2]) {
      if (stat == 1) {
        dp[i]++;
        stat = 2;
      } else {
        stat = 1;
      }
    }
  }
  cout << dp[n - 1];
}
