#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = mod * mod;
const long double eps = 1e-12;
const long double pi = acos(-1.0);
long long qp(long long a, long long b, int mo) {
  int ans = 1;
  do {
    if (b & 1) ans = 1ll * ans * a % mo;
    a = 1ll * a * a % mo;
  } while (b >>= 1);
  return ans;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
template <typename T>
istream &operator>>(istream &is, vector<T> &vector<long long>) {
  for (auto &v : vector<long long>) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vector<long long>) {
  os << "[";
  for (auto v : vector<long long>) os << v << ",";
  os << "]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const deque<T> &vector<long long>) {
  os << "deq[";
  for (auto v : vector<long long>) os << v << ",";
  os << "]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &vector<long long>) {
  os << "{";
  for (auto v : vector<long long>) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_set<T> &vector<long long>) {
  os << "{";
  for (auto v : vector<long long>) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &vector<long long>) {
  os << "{";
  for (auto v : vector<long long>) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os,
                    const unordered_multiset<T> &vector<long long>) {
  os << "{";
  for (auto v : vector<long long>) os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &pa) {
  os << "(" << pa.first << "," << pa.second << ")";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const map<TK, TV> &mp) {
  os << "{";
  for (auto v : mp) os << v.first << "=>" << v.second << ",";
  os << "}";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp) {
  os << "{";
  for (auto v : mp) os << v.first << "=>" << v.second << ",";
  os << "}";
  return os;
}
template <typename T>
void ndarray(vector<T> &vector<long long>, int len) {
  vector<long long>.resize(len);
}
template <typename T, typename... Args>
void ndarray(vector<T> &vector<long long>, int len, Args... args) {
  vector<long long>.resize(len);
  for (auto &v : vector<long long>) ndarray(v, args...);
}
template <typename T>
bool chmax(T &m, const T q) {
  if (m < q) {
    m = q;
    return true;
  } else
    return false;
}
template <typename T>
bool chmin(T &m, const T q) {
  if (q < m) {
    m = q;
    return true;
  } else
    return false;
}
template <typename T1, typename T2>
pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) {
  return make_pair(l.first + r.first, l.second + r.second);
}
template <typename T1, typename T2>
pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) {
  return make_pair(l.first - r.first, l.second - r.second);
}
template <typename T1, typename T2>
pair<T1, T2> operator<(const pair<T1, T2> l, const pair<T1, T2> r) {
  return (l.first < r.first);
}
template <typename T1, typename T2>
pair<T1, T2> operator>(const pair<T1, T2> l, const pair<T1, T2> r) {
  return (l.first > r.first);
}
void solve() {
  string S;
  cin >> S;
  int res = 0;
  string pre = "####";
  long long n = S.size();
  if (n == 1) {
    cout << 1 << endl;
    return;
  }
  for (int i = 0; i < n; i++) {
    long long div_n;
    if (i == 0 || S[i] != S[i - 1]) {
      div_n = 1;
    } else {
      div_n = 2;
    }
    if (i == n - 2) {
      if (S[n - 2] == S[n - 1]) {
        res++;
        i += 2;
      } else {
        pre = S.substr(i, div_n);
        res++;
        if (div_n > 1) i++;
      }
    } else {
      pre = S.substr(i, div_n);
      res++;
      if (div_n > 1) i++;
    }
  }
  cout << res << endl;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  std::cout << fixed << setprecision(10);
  solve();
  return 0;
}
