def dfs(res, depth, path, S):
    if depth == len(S) - 1:
        res.append(path)
        return
    for i in range(depth+1, len(S)):
        if not path or path[-1] != S[depth:i]:
            dfs(res, i, path + [S[depth:i]], S)

S = input()
S+='*'
    
res = []
dfs(res, 0, [], S)

if not res:
    print(0)
else:
    print(len((sorted(res, key=lambda x: len(x), reverse=True)[0])))