#include <bits/stdc++.h>
using namespace std;
long long find(int n) {
  int left = 1, right = n;
  while (left < right) {
    int mid = (left + right + 1) / 2;
    if ((1ll * mid * (mid + 1)) / 2 > n) {
      right = mid - 1;
    } else {
      left = mid;
    }
  }
  return left;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  string s;
  cin >> s;
  vector<pair<int, int>> dp(s.size());
  dp[0].first = 1;
  dp[0].second = -1e9;
  for (int i = 1; i < s.size(); ++i) {
    if (s[i - 1] != s[i]) {
      dp[i].first = max(dp[i - 1].first, dp[i - 1].second) + 1;
    } else {
      dp[i].first = dp[i - 1].second + 1;
    }
    if (i == 1) {
      dp[i].second = 1;
    } else if (i == 2) {
      dp[i].second = 1 + dp[i - 2].first;
    } else {
      if (s[i] + s[i - 1] != s[i - 2] + s[i - 3]) {
        dp[i].second = max(dp[i - 2].first, dp[i - 2].second) + 1;
      } else {
        dp[i].second = dp[i - 2].first;
      }
    }
  }
  cout << max(dp[s.size() - 1].first, dp[s.size() - 1].second);
  return 0;
}
