#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  vector<string> p;
  if (s.size() == 1) {
    cout << 1 << endl;
    return 0;
  } else if (s.size() == 2) {
    if (s[0] == s[1]) {
      cout << 1 << endl;
    } else {
      cout << 2 << endl;
    }
    return 0;
  }
  int flag = 0;
  int num = 0;
  for (int i = 0; i < s.size() - 1; i++) {
    string q = "";
    q += s[i];
    if (i == 0) {
      p.push_back(q);
      num = 0;
    } else if (i == s.size() - 2) {
      if (q == p[num]) {
        q += s[i + 1];
        p.push_back(q);
        i++;
      } else {
        if (s[i] == s[i + 1]) {
          q += s[i + 1];
          if (q == p[num]) {
            flag = 1;
          }
          p.push_back(q);
          i++;
        } else {
          p.push_back(q);
          q = s[i + 1];
          if (q == p[num]) {
            flag = 1;
          }
          p.push_back(q);
          i++;
        }
      }
    } else {
      if (q == p[num]) {
        q += s[i + 1];
        i++;
      } else if (q != p[num]) {
      }
      p.push_back(q);
      num++;
    }
  }
  if (flag == 1) {
    cout << p.size() - 1 << endl;
    return 0;
  }
  cout << p.size() << endl;
}
