#include <bits/stdc++.h>
using namespace std;
int main() {
  int state = 0;
  char ch, prev_ch = '\0';
  int count = 0;
  while ((ch = getchar()) != EOF && isalpha(ch)) {
    if (state == 0) {
      if (ch == prev_ch) {
        state = 1;
      } else {
        count++;
      }
    } else {
      if (ch == prev_ch) {
        count++;
      } else {
        count++;
        state = 0;
      }
    }
    prev_ch = ch;
  }
  if (state == 1) count++;
  printf("%d\n", count);
  return 0;
}
