#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};
void solve() {
  string s;
  cin >> s;
  int sum = 2;
  for (int64_t i = (0); i < (s.size() - 1); i++) {
    if (s[i] != s[i + 1]) sum++;
  }
  cout << sum << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
