#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&...tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}
int main() {
  string S;
  cin >> S;
  auto count = [&](int start) -> int {
    bool one = start == 1 ? true : false;
    char prev = S[start - 1];
    int cnt = 1;
    for (long long i = (start); i < (long long)(S.length()); ++i) {
      if (one && S[i] == prev) {
        one = 0;
        i++;
        prev = ' ';
        if (i >= (int)S.length()) cnt = -100;
      } else {
        one = 1;
        prev = S[i];
      }
      cnt++;
    }
    return cnt;
  };
  cout << max(count(1), count(2)) << endl;
  return 0;
}
