#include <bits/stdc++.h>
using namespace std;
template <typename T>
istream& operator>>(istream& istr, vector<T>& vec) {
  for (T& x : vec) istr >> x;
  return istr;
}
template <typename T>
ostream& operator<<(ostream& ostr, vector<T>& vec) {
  if (!vec.empty()) {
    ostr << vec.front();
    for (auto itr = ++vec.begin(); itr != vec.end(); itr++) ostr << " " << *itr;
  }
  return ostr;
}
template <typename T>
ostream& operator<<(ostream& ostr, vector<vector<T>>& mat) {
  if (!mat.empty()) {
    ostr << mat.front();
    for (auto itr = ++mat.begin(); itr != mat.end(); itr++)
      ostr << endl << *itr;
  }
  return ostr;
}
template <typename T, typename U>
ostream& operator<<(ostream& ostr, vector<pair<T, U>>& vpr) {
  if (!vpr.empty()) {
    auto x = vpr.front();
    ostr << x.first << " " << x.second;
    for (auto itr = ++vpr.begin(); itr != vpr.end(); itr++) {
      x = *itr;
      ostr << endl << x.first << " " << x.second;
    }
  }
  return ostr;
}
int main() {
  string s;
  cin >> s;
  long long n = s.size();
  long long a = 1, t = 0;
  for (long long i = 0; i < (n - 2); i++) {
    if (t < 1) {
      t = 1;
      a++;
    } else if (t > 1) {
      t--;
      a++;
    } else if (s[i] == s[i - 1]) {
      t = 3;
    } else {
      a++;
    }
  }
  if (t >= 2 || s[n - 2] != s[n - 1]) a++;
  cout << a << endl;
  return 0;
}
