#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int ans = 0;
  int n = s.size();
  bool ok = false;
  for (int i = 0; i < n; i++) {
    if ((i - 1 >= 0 && s[i - 1] == s[i]) || (i + 1 < n && s[i] == s[i + 1]))
      ok = !ok;
    else
      ok = false;
    if (ok) ans++;
  }
  cout << n - (ans - 1) << endl;
  return 0;
}
