import sys, math
from functools import lru_cache
from collections import deque
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

S = input()
dp = [0]*(len(S)+1)
dp[0] = 0
dp[1] = dp[2] = 1
for i in range(3, len(S)+1):
    if S[i-1] != S[i-2]:
        dp[i] = dp[i-1] + 1
    else:
        dp[i] = dp[i-3] + 2

print(dp[-1])
