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