#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int inf = 0x3f3f3f3f;
int a[maxn], b[maxn];
int n, m;
int dp[maxn][2];
string str;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> str;
  int len = str.length();
  dp[0][0] = dp[0][1] = 1;
  if (str[1] == str[0]) {
    dp[1][0] = -inf;
  } else {
    dp[1][0] = 2;
  }
  dp[1][1] = 2;
  for (int i = 2; i < len; i++) {
    if (str[i] != str[i - 1]) {
      dp[i][0] = max(dp[i - 1][0], dp[i - 2][1]) + 1;
    } else {
      dp[i][0] = dp[i - 2][1] + 1;
    }
    if (str[i] == str[i - 2] && str[i + 1] == str[i - 2]) {
      dp[i][1] = dp[i - 1][0] + 1;
    } else {
      dp[i][1] = max(dp[i - 1][0], dp[i - 2][1]) + 1;
    }
  }
  cout << max(dp[len - 1][0], dp[len - 1][1]) << endl;
}
