#include <bits/stdc++.h>
using namespace std;
int main() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int countt = 0;
  char prev, next;
  for (int i = 1; i < s.length(); i++) {
    prev = s[i - 1];
    next = s[i];
    if (next != prev) {
      countt++;
    }
  }
  cout << countt + 2 << endl;
  return 0;
}
