#include <bits/stdc++.h>
using namespace std;
string s;
int ans = 1;
int main() {
  cin >> s;
  int len = s.length();
  for (int i = 1; i < len; i++) {
    if (s[i] != s[i + 1]) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
