#include <bits/stdc++.h>
using namespace std;
int index(int numToFind, std::vector<int> vectorToFindIn) {
  int len = vectorToFindIn.size();
  for (int i = 0; i < len; i++) {
    if (vectorToFindIn[i] == numToFind) {
      return i;
    }
  }
  return -1;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
string to_upper(string a) {
  for (int i = 0; i < (int)a.size(); ++i)
    if (a[i] >= 'a' && a[i] <= 'z') a[i] -= 'a' - 'A';
  return a;
}
string to_lower(string a) {
  for (int i = 0; i < (int)a.size(); ++i)
    if (a[i] >= 'A' && a[i] <= 'Z') a[i] += 'a' - 'A';
  return a;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s, cur;
  cin >> s;
  int n = s.length(), m = 0, k;
  vector<string> v;
  cur = "";
  cur += s[0];
  v.push_back(cur);
  cur = "";
  for (int i = 0; i < n; ++i) {
    cur += s[i];
    if (cur != v[m]) {
      v.push_back(cur);
      ++m;
      cur = "";
    } else if (cur.length() > 1) {
      k = v[m].length();
      cur += v[m][k - 1];
      v[m].pop_back();
      v.push_back(cur);
      cur = "";
      ++m;
    }
  }
  cout << m;
  return 0;
}
