#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
int dp[202020][4];
string slice(int i, int j, string a) {
  string ret = "";
  for (int k = i; k <= j; k++) {
    ret += a[k];
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  int N = s.size();
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= 3; j++) {
      if (i - j < 0) continue;
      for (int k = 0; k <= 3; k++) {
        if (k != j)
          dp[i][j] = max(dp[i - j][k] + 1, dp[i][j]);
        else if (i - 2 * j < 0)
          continue;
        else if (slice(i - j, i - 1, s) != slice(i - 2 * j, i - j - 1, s))
          dp[i][j] = max(dp[i - j][k] + 1, dp[i][j]);
      }
    }
  }
  cout << max(dp[N][1], max(dp[N][2], dp[N][3])) << endl;
  return 0;
}
