#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int count = 0, i = 0, l = S.length();
  while (1) {
    if (i < l) {
      if (S[i] != S[i + 1]) count++;
    } else
      break;
    i++;
  }
  cout << count + 1 << endl;
}
