#include <bits/stdc++.h>
using namespace std;
const char *s = 0;
string n;
int l;
bool visit[100000];
int main() {
  int cnt = 0;
  cin >> n;
  s = n.data();
  l = n.length();
  for (int i = l - 1; i >= 0;) {
    if (i > 1) {
      if (s[i] == s[i - 1]) {
        cnt = cnt + 2;
        i = i - 3;
      }
      if (s[i] != s[i - 1]) {
        cnt++;
        i = i - 1;
      }
    }
    if (i == 1) {
      if (s[0] == s[1]) {
        cout << cnt + 1;
        break;
      } else {
        cout << cnt + 2;
        break;
      }
    }
  }
  return 0;
}
