#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  char zenkai = s[0];
  int ans = 1;
  for (long long(i) = 1; (i) < (long long)(s.size()); ++(i)) {
    if (zenkai == s[i]) {
    } else {
      zenkai = s[i];
      ans++;
    }
  }
  cout << ans + 1 << endl;
  return 0;
}
