#include <bits/stdc++.h>
using namespace std;
int main() {
  string x;
  cin >> x;
  int count;
  for (int i = 0; i < x.size(); i++) {
    if (i == x.size()) {
      if (x.at(i - 1) == x.at(i))
        break;
      else {
        count++;
        break;
      }
    }
    if (x.at(i) == x.at(i + 1))
      continue;
    else
      count++;
  }
  cout << count << endl;
}
