#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int ans = -1;
vector<string> split(const string &s, int n) {
  if (s.size() < n) {
    vector<string> ret;
    ret.push_back(s);
    ret.push_back("");
    return ret;
  }
  vector<string> ret;
  ret.push_back(s.substr(0, n));
  ret.push_back(s.substr(n));
  return ret;
}
void DFS(const string &S, int n, string prev, int temp_K) {
  vector<string> temp_S = split(S, n);
  if (temp_S.at(0) == prev) return;
  if (S.size() == n) {
    ++temp_K;
    ans = max(ans, temp_K);
    return;
  }
  ++temp_K;
  for (int i = 1; i <= 2; ++i) DFS(temp_S.at(1), i, temp_S.at(0), temp_K);
}
int main() {
  string S;
  cin >> S;
  int temp_K = 0;
  string prev;
  for (int i = 1; i <= 2; ++i) DFS(S, i, prev, temp_K);
  cout << ans << endl;
  return 0;
}
