#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  string s;
  cin >> s;
  vector<int> U;
  int count = 1;
  for (int i = 0; i < (s.length() - 1); ++i) {
    if (s[i] == s[i + 1]) {
      count++;
    } else {
      U.push_back(count);
      count = 1;
    }
  }
  U.push_back(count);
  int ans = 0;
  bool mochi = false;
  for (int i = 0; i < (U.size() - 1); ++i) {
    if (U[i] == 0) continue;
    if (!mochi) {
      if (U[i] == 1) {
        ans++;
        continue;
      } else {
        ans++;
        U[i] = 1;
        i--;
        mochi = true;
      }
    } else {
      ans++;
      U[i + 1]--;
      mochi = false;
    }
  }
  if (U[U.size() - 1] != 0) ans++;
  cout << ans << "\n";
}
