#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int dp[1001001];
  dp[0] = 0;
  dp[1] = 1;
  dp[2] = 2;
  for (int i = 1; i < s.size(); i++) {
    if (s[i - 1] == s[i - 2])
      dp[i + 1] = dp[i];
    else
      dp[i + 1] = dp[i] + 1;
  }
  cout << dp[s.size()] << endl;
}
