#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
long long int power(long long int x, long long int y,
                    long long int mod = 1e9 + 7) {
  long long int res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res % mod;
}
void solve() {
  string s;
  cin >> s;
  int last = 0, cur = 0, count = 2;
  while (cur < s.size()) {
    while (cur < s.size() && s[cur] == s[last]) cur += 1;
    if (cur < s.size()) count += 1;
    last = cur;
    cur += 1;
  }
  cout << count << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int test = 1;
  while (test--) solve();
  return 0;
}
