import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  auto s = readln.chomp;
  auto dp = new int[](s.length+1);
  dp[0] = 0;
  dp[1] = 1;
  if (dp.length > 2) {
    if (s[0] == s[1]) {
      dp[2] = 1;
    } else {
      dp[2] = 2;
    }
  } 

  foreach (i; 3..s.length+1) {
    if (s[i-2] != s[i-1]) {
      dp[i] = dp[i-1] + 1;
    } else {
      dp[i] = max(dp[i-1], dp[i-3] + 2);
    }
  }
  //dp.writeln;
  dp[$-1].writeln;
} 
