#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  vector<bool> s;
  for (int i = 0; i < S.length(); i++) {
    if (S[i] == 'W')
      s.push_back(true);
    else
      s.push_back(false);
  }
  unsigned int cnt = 0;
  auto itr_s = s.begin();
  auto itr_e = itr_s;
  while (itr_e < s.end()) {
    if (*itr_s != *itr_e) {
      itr_s = itr_e;
      cnt++;
    }
    itr_e++;
  }
  cout << cnt;
}
