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