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