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