#include <bits/stdc++.h>
using namespace std;
template <class T = long long>
using V = vector<T>;
template <class T = long long>
using VV = V<V<T>>;
using P = pair<long long, long long>;
template <class T>
void scan(T a) {
  cin >> a;
}
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(long double &a) { cin >> a; }
void scan(char a[]) { scanf("%s", a); }
void scan(string &a) { cin >> a; }
template <class T>
void scan(V<T> &);
template <class T, class L>
void scan(pair<T, L> &);
template <class T>
void scan(V<T> &a) {
  for (auto &i : a) scan(i);
}
template <class T, class L>
void scan(pair<T, L> &p) {
  scan(p.first);
  scan(p.second);
}
template <class T>
void scan(T &a) {
  cin >> a;
}
void IN() {}
template <class Head, class... Tail>
void IN(Head &head, Tail &...tail) {
  scan(head);
  IN(tail...);
}
template <class T>
inline void print(T x) {
  cout << x << '\n';
}
template <class T>
V<T> press(V<T> &x) {
  V<T> res = x;
  sort((res).begin(), (res).end());
  res.erase(unique((res).begin(), (res).end()), res.end());
  for (long long i = (0); i < (((long long)(x).size())); ++i) {
    x[i] = lower_bound((res).begin(), (res).end(), x[i]) - res.begin();
  }
  return res;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
inline void Yes(bool b = true) { cout << (b ? "Yes" : "No") << '\n'; }
inline void YES(bool b = true) { cout << (b ? "YES" : "NO") << '\n'; }
inline void err(bool b = true) {
  if (b) {
    cout << -1 << '\n';
    exit(0);
  }
}
template <class T>
inline void fin(bool b = true, T e = 0) {
  if (b) {
    cout << e << '\n';
    exit(0);
  }
}
template <class T>
T Roundup_div(T x, T y) {
  return (x + (y - 1)) / y;
}
template <typename T>
T pow(T a, long long n, T e = 1) {
  T ret = e;
  while (n) {
    if (n & 1) ret *= a;
    a *= a;
    n >>= 1;
  }
  return ret;
}
const long long INF = 1e18;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ;
  string s;
  IN(s);
  int n = ((long long)(s).size());
  V<> dp(n + 1, INF);
  fin(n == 1, 1);
  fin(n == 2, 1 + s[0] != s[1]);
  V<> d(n, 0);
  d[0] = 1, d[1] = (1 + s[0] != s[1]), d[2] = (s[1] == s[2] ? 2 : d[1] + 1);
  for (int i = 3; i < n; i++) {
    if (s[i] == s[i - 1])
      d[i] = d[i - 3] + 2;
    else
      d[i] = d[i - 1] + 1;
  }
  print(d[n - 1]);
}
