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