#include <bits/stdc++.h>
using namespace std;
string s;
int convert(string s) {
  int res = 0;
  for (int i = s.size() - 1; i >= 0; i--) {
    res += pow(26, (s.size() - 1) - i) * (s[i] - 'a');
  }
  return res;
}
map<pair<int, string>, int> mapi;
int solve(int cur, string last) {
  if (cur >= s.size()) {
    return 0;
  }
  if (mapi.find({cur, last}) != mapi.end()) return mapi[{cur, last}];
  string s1 = "" + last[cur], s2 = s1;
  if (cur + 1 < s.size()) s2 += last[cur + 1];
  int res = max(solve(cur + 1, s1) + (last != s1),
                solve(cur + 2, s2) + (s2 != last && cur + 1 < s.size()));
  return mapi[{cur, last}] = res;
}
int main() {
  cin >> s;
  cout << solve(0, "");
  return 0;
}
