#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long INF = 1e18;
const double pi = acos(-1.0);
int main(void) {
  string s;
  cin >> s;
  long long n = s.size(), ans = 0;
  for (long long i = 0; i < (n - 1); ++i) {
    if (s[i] != s[i + 1]) ans++;
  }
  cout << ans + 2 << endl;
  return 0;
}
