#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  cin >> a;
  int ans = 2;
  for (long long i = 0; i < (long long)(a.length() - 1); i++) {
    if (a[i] != a[i + 1]) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
