#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  int n = s.size();
  vector<int> A(n + 1, 0), B(n + 1, 0);
  A[1] = 1;
  s = " " + s;
  for (int i = 2; i <= n; i++) {
    int Max = 0;
    Max = max(Max, 1 + B[i - 1]);
    if (s[i] != s[i - 1]) Max = max(Max, 1 + A[i - 1]);
    A[i] = Max;
    Max = 0;
    Max = max(Max, 1 + A[i - 2]);
    B[i] = Max;
  }
  cout << max(A[n], B[n]);
}
