#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
__attribute__((unused))
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
__attribute__((unused))
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
__attribute__((unused))
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
__attribute__((unused))
auto constexpr infty<int> = 1'100'100'100;
template<>
__attribute__((unused))
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

using namespace std;

lli solve(string const &str) {
  auto const n = str.size();
  if (n < 2) { return 1; }
  vector<lli> dp1(n, 0), dp2(n, 1);
  dp1[0] = 1, dp1[1] = (str[0] != str[1] ? 1: 0);
  dp2[0] = 0, dp2[1] = 1;
  for (int i = 2; i < n; ++i) {
    dp1[i] = max(
        dp2[i-1] + 1,
        str[i-1] != str[i] ? dp1[i-1] + 1 : 0);
    dp2[i] = max(
        dp1[i-2] + 1,
        (i > 2 && str.substr(i-3,2) != str.substr(i-1,2)) ? dp2[i-2] + 1 : 0);
  }
  return max(dp1[n-1], dp2[n-1]);
}

int main() {
  // cout << fixed << setprecision(10);

  string S;
  cin >> S;
  cout << solve(S) << endl;
  return 0;
}
