#include <bits/stdc++.h>
using namespace std;
static const int INF = INT_MAX;
static const long long LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const long long LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;
const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};
vector<int> Div(int n) {
  vector<int> ret;
  for (int i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int cnt = s.size();
  for (int i = 1; i < s.size() - 1; ++i) {
    if (s[i] == s[i + 1]) --cnt;
  }
  cout << cnt << '\n';
  return 0;
}
