#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  S += '0';
  vector<int> v;
  int n = S.size();
  int cnt = 1;
  for (int i = 0; i < n - 1; i++) {
    if (S[i] != S[i + 1]) {
      v.push_back(cnt);
      cnt = 1;
    } else {
      cnt++;
    }
  }
  int ans = 0;
  int flag = 0;
  for (int i = 0; i < v.size(); i++) {
    int n = v[i] / 2;
    if (v[i] % 2) n++;
    if (i > 0 && v[i] % 2 == 0 && v[i - 1] % 2 == 0) {
      if (flag) {
        n++;
        flag = 0;
      } else
        flag = 1;
    }
    ans += n;
  }
  cout << ans << endl;
}
