#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    string a;
    cin >> a;
    int n = a.length();
    int k = 0;
    int flag = 0;
    for (int i = 1; i < n; i++) {
      if (flag == 0 && a[i] != a[i - 1]) {
        k = k + 2;
        i++;
      } else if (flag == 1) {
        k = k + 1;
        flag = 0;
      } else if (flag == 0 && a[i] == a[i - 1]) {
        k = k + 1;
        flag = 1;
        i++;
      }
    }
    cout << k << endl;
  }
  return 0;
}
