# 2019/08/17
# AtCoder Grand Contest 037 - A

# Input
s = input()

# Count
sav_ps = s[0]
i = 1
scnt = 1
ans = 0
while i < len(s):
    # s[i] != s[i+1] 
    if sav_ps != s[i]:
        sav_ps = s[i]
        if scnt == 1:
            ans = ans + 1
        elif scnt == 2:
            ans = ans + 2
            i = i + 1
        else:
            ans = ans + int(scnt / 2) + 1
            
        scnt = 1
    # s[i] == s[i+1] 
    else:
        scnt = scnt + 1

    i = i + 1

if scnt == 1 or scnt == 2:
    ans = ans + 1
elif scnt > 2:
    ans = ans + int(scnt / 2) + 1

if i > len(s):
    ans = ans - 1

# Output
print(ans)
