#include <bits/stdc++.h>
using namespace std;
using ll = long long;
mt19937 mt(736);
int foo(const string &s, const string &last = "", int p = 0) {
  static map<pair<int, string>, int> dp;
  if (p == s.size()) return 0;
  for (int i = p + 1; i <= s.size() && i < p + 4; i++)
    if (s.substr(p, i - p) != last)
      dp[{p, last}] = max(dp[{p, last}], 1 + foo(s, s.substr(p, i - p), i));
  return dp[{p, last}];
}
void solve(istream &cin = std::cin, ostream &cout = std::cout) {
  string s;
  cin >> s;
  cout << foo(s) << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed;
  solve();
  return 0;
}
