#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
template <typename T>
void ndarray(vector<T> &vec, int len) {
  vec.resize(len);
}
template <typename T, typename... Args>
void ndarray(vector<T> &vec, int len, Args... args) {
  vec.resize(len);
  for (auto &v : vec) ndarray(v, args...);
}
int main() {
  string S;
  cin >> S;
  int n = (int)S.length();
  vector<vector<int>> dp;
  ndarray(dp, n + 1, 2);
  dp[1][1] = 1;
  dp[1][1] = 1;
  for (int next = 1; next <= n; next++) {
    if (S[next] != S[next - 1]) {
      dp[next][0] = std::max(dp[next - 1][0], dp[next - 1][1]) + 1;
    } else {
      dp[next][0] = dp[next - 1][1] + 1;
      dp[next][1] = dp[next - 1][0];
    }
  }
  cout << std::max(dp[n][0], dp[n][1]) << endl;
  return 0;
}
