#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

S = str(input())
N = len(S)
count = 1
now = 1
temp = S[0]
while now<=N-1:
    if now == N-1:
        if temp == S[N-1]:
            break
        else:
            count += 1
            break
    for i in range(now+1,N):
        if S[now:i] != temp:
            count += 1
            temp = S[now:i]
            now = i
            break
print(count)