#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = pow(10, 9) + 7;
ll mod(ll A, ll M) { return (A % M + M) % M; }
const ll INF = 1LL << 60;
template <class T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
ll divCeil(ll A, ll B) { return (A + (B - 1)) / B; }
ll myctoi(char C) { return C - '0'; }
char myitoc(ll N) { return '0' + N; }
int main() {
  string S;
  cin >> S;
  ll N = S.size();
  ll ans = 1;
  for (ll i = 0; i < N - 1; i++) {
    if (S.at(i) != S.at(i + 1)) ans++;
  }
  if (ans != 1) ans++;
  cout << ans << endl;
}
