#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  string s;
  cin >> s;
  int ans = 0;
  int lst = 0;
  char ls = '?';
  for (int i = 0; i <= s.length() - 1; i++) {
    int j = i;
    while (s[j] == s[i]) {
      j++;
    }
    if (ls == s[i + 1] && j - i == 1) lst = 0;
    if (j - i - lst >= 2) ans += max(1, (j - lst - i - 1) / 2);
    if ((j + lst - i) % 2 == 0) {
      lst = 1;
      ls = s[i];
    } else
      lst = 0;
    i = j - 1;
  }
  ans = s.length() - ans;
  cout << ans;
  return 0;
}
