#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;
bool sosu_check(int x) {
  for (int i = 2; i < x; i++) {
    if (x % i == 0) return false;
  }
  return true;
}
int main() {
  string S;
  cin >> S;
  ll N = S.size();
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] != S[i + 1]) ans++;
  }
  cout << ans + 1 << endl;
}
