#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int counter = 1;
  int n = S.length();
  for (int i = 0; i <= n - 1; i++) {
    if (S[i] != S[i + 1]) {
      ++counter;
    }
  }
  cout << counter << endl;
}
