from fractions import gcd
import math

mod = 998244353

def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft

def rec(s, dp, i, l):
    if i == 0:
        return 1
    if dp[i][l] != -1:
        return dp[i][l]
    ret = [0, 0]
    if s[i-1] != s[i]:
        ret[0] = rec(s, dp, i-1, 1)
    if 1 < i  and s[i-2:i] != s[i:i+2]:
        ret[1] = rec(s, dp, i-2, 2)
    dp[i][l] = max(ret)
    return dp[i][l]


def main():
    s = input()
    n = len(s)
    inf = 100000000
    dp = [[-inf] * 2 for i in range(n+2)]
    dp[0][0] = 1
    dp[1][1] = 1
    for i in range(n-1):
        if s[i] != s[i+1]:
            dp[i+1][0] = max(dp[i][0] + 1, dp[i+1][1]) if -inf != dp[i][0] else dp[i+1][1]
        dp[i+2][1] = max(dp[i][0] + 1, dp[i+2][1]) if -inf != dp[i][0] else dp[i+2][1]
        dp[i+1][0] = max(dp[i][1] + 1, dp[i+1][0]) if -inf != dp[i][1] else dp[i+1][0]
        if i > 1 and s[i-1:i+1] != s[i+1:i+3]:
            dp[i+1][1] = max(dp[i][1] + 1, dp[i+1][1]) if -inf != dp[i][1] else dp[i+1][1]

    print(max(dp[n-1]))
    # print([i[0] for i in dp])
    # print([i[1] for i in dp])

main()
