#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int dp[101000][3];
int main() {
  string S;
  cin >> S;
  int ssize = (int)S.size();
  int ans = 1;
  for (int i = 1; i < ssize; i++) {
    if (S[i - 1] == S[i])
      continue;
    else
      ans++;
  }
  cout << ans << endl;
  return 0;
}
