#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  string s;
  cin >> s;
  int N = s.length();
  vector<int> dp1(200002);
  vector<int> dp2(200002);
  if (N == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (s[0] == s[1]) {
    dp1[0] = 1;
    dp2[0] = 0;
    dp1[1] = 1;
    dp2[1] = 1;
  } else {
    dp1[0] = 1;
    dp2[0] = 0;
    dp1[1] = 2;
    dp2[1] = 1;
  }
  for (int i = (2); i <= (N - 1); ++i) {
    if (s[i] == s[i - 1]) {
      dp1[i] = dp2[i - 1] + 1;
      dp2[i] = dp1[i - 1] + 1;
    } else {
      dp1[i] = dp1[i - 1] + 1;
      dp2[i] = dp1[i - 2] + 1;
    }
  }
  cout << max(dp1[N - 1], dp2[N - 1]) << endl;
}
