#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int num = 1;
  int count = 0;
  int n = s.size();
  for (int i = (1); i < (n); i++) {
    if (s[i] == s[i - 1])
      num++;
    else if (s[i] != s[i - 1]) {
      count += num / 2;
      num = 1;
    }
  }
  count += num / 2;
  if (n % 2 == 1)
    cout << n - count << endl;
  else
    cout << n - count + 1 << endl;
}
