import sys


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


def main():
    S = input()
    if len(S) == 1:
        print(1)
        sys.exit()
    elif S[0] == S[1]:
        if len(S) == 2:
            print(1)
            sys.exit()
        f = 2
        tmp = S[0:2]
    else:
        f = 1
        tmp = S[0]
    ans = 1

    for i in range(f, len(S)):
        if tmp != S[i]:
            ans += 1
            tmp = S[i]
        else:
            tmp += S[i]
    if len(tmp) > 1:
        ans += 1
    print(ans)


if __name__ == '__main__':
    main()
