#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int ans = -1;
vector<string> split(const string &s, int n) {
  vector<string> ret;
  ret.push_back(s.substr(0, n));
  ret.push_back(s.substr(n));
  return ret;
}
int main() {
  string S;
  cin >> S;
  int K = 0;
  string prev;
  int s_n = 1;
  while (1) {
    if (S.size() == 2) {
      if (S.at(0) == S.at(1)) {
        ++K;
        break;
      } else {
        K += 2;
        break;
      }
    } else if (S.size() == 1) {
      ++K;
      break;
    }
    vector<string> temp_S = split(S, s_n);
    if (temp_S.at(0) == prev) {
      ++s_n;
      continue;
    }
    ++K;
    prev = temp_S.at(0);
    S = temp_S.at(1);
    s_n = 1;
  }
  cout << K << endl;
  return 0;
}
