def count_k(chars, previous):
    if chars == previous:
        return 0
    max_k = 1
    for n in range(1, len(chars)):
        block1 = chars[:n]
        if block1 == previous:
            continue
        block2 = chars[n:]
        k = count_k(block2, block1) + 1
        if k == 1:
            continue
        if max_k >= k:
            break
        else:
            max_k = k
    return max_k


s = input()
print(count_k(tuple(s), tuple()))
