#include <bits/stdc++.h>
using namespace std;
void accelerate() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
const int INF = 0x3f3f3f3f;
const int MAXN = 2e5 + 10;
int dp[MAXN][2];
string s;
int solve(int n, int m) {
  if (n >= s.size()) return dp[n][m] = 0;
  if (dp[n][m] != -1) return dp[n][m];
  if (n < 2) {
    int vl = solve(n + 1, 0) + 1;
    int vr = solve(n + 2, 1) + 1;
    return dp[n][m] = max(vl, vr);
  }
  if (m == 0) {
    int vl = solve(n + 1, 0) + 1;
    int vr = solve(n + 2, 1) + 1;
    if (s[n] == s[n - 1]) {
      if (n == s.size() - 1) {
        return dp[n][m] = 0;
      }
      return dp[n][m] = vr;
    }
    return dp[n][m] = max(vl, vr);
  } else {
    int vl = solve(n + 1, 0) + 1;
    int vr = solve(n + 2, 1) + 1;
    if (n + 1 >= s.size()) {
      return dp[n][m] = 0;
    }
    if (s[n - 2] == s[n] && s[n - 1] == s[n + 1]) {
      return dp[n][m] = vl;
    } else {
      return dp[n][m] = max(vl, vr);
    }
  }
}
int main() {
  accelerate();
  cin >> s;
  if (s.size() == 2 && s[0] == s[1]) {
    cout << 1 << endl;
    return 0;
  }
  memset(dp, -1, sizeof dp);
  cout << max(1, solve(0, 0)) << endl;
}
