S = input()

def split_k(sn):
    len_sn = len(sn)
    if len_sn < 2:
        return len_sn
    elif len_sn == 2:
        if sn[0] == sn[1]:
            return 1
        else:
            return 2
    s3_k = 0
    for len1 in range(1, 1+len_sn):
        s1 = sn[:len1]
        for len2 in range(1, 1+(len_sn-len1)):
            s2 = sn[len1:len1+len2]
            s3 = sn[len1+len2:]
            if s1 != s2 and s2 != s3:
                #print("{}: {} {} {}".format(sn, s1, s2, s3))
                s12_k = 2
                if s3_k < len(s3):
                    s3_k = max(s3_k, split_k(s3))
            else:
                pass
    return 2 + s3_k

K = split_k(S)
print(K)
