from itertools import combinations

s = input()
n = len(s)
ap = list(range(1, n))

set_s = set()


def check(k):
    if k == 1:
        return True

    rtn = False
    for v in combinations(ap, k - 1):
        can = True
        x_past = 0
        w_past = ""

        for x in v:
            w = s[x_past:x]
            if w == w_past:
                can = False
                break
            x_past = x
            w_past = w
        w_last = s[v[-1] :]
        if w == w_last:
            can = False

        if can is True:
            rtn = True
            break

    return rtn


low = 1
high = n
while low <= high:
    mid = (low + high) // 2
    if check(mid):
        low = mid + 1
    else:
        high = mid - 1

print(min(high, low))
