#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n, i = 1;
  n = s.size();
  if (n == 1)
    cout << 1 << endl;
  else {
    vector<int> a(1);
    while (s.at(i) == s.at(i + 1)) i++;
    a.at(0) = i;
    while (i < n) {
      if (i == n - 1) {
        a.push_back(1);
        i++;
      } else {
        int p = 1;
        for (int k = i; k < n - 1; k++) {
          if (s.at(k) == s.at(k + 1))
            p++;
          else
            break;
        }
        a.push_back(p);
        i += p;
      }
    }
    cout << a.size() << endl;
  }
}
