
S = input()



def f(prev, s):
    if len(s) == 1 and s != prev:
        return 1
    res = 0
    for i in range(1, len(s)+1):
        if s[:i] != prev:
            res = max(res, 1 + f(s[:i], s[i:]))
    return res
print(f(set(),S))
