def get_cache(chars, start, end, cache=dict()):
    pair = (start, end)
    block = cache.get(pair)
    if block is not None:
        return block
    else:
        block = chars[start:end]
        cache[pair] = block
        return block


def get_skip(chars, previous_start, previous_end, cache=dict()):
    pair = (previous_start, previous_end)
    if pair in cache:
        return cache[pair]

    skip = len(chars)
    previous_len = previous_end - previous_start
    if previous_end + previous_len < len(chars):
        previous = get_cache(chars, previous_start, previous_end)
        suspicious_end = previous_end + previous_len
        suspicious = get_cache(chars, previous_end, previous_end + previous_len)
        if previous == suspicious:
            skip = suspicious_end
    cache[pair] = skip
    return skip


def count_k(chars):
    cache = dict()
    stack = []
    previous_start = 0
    previous_end = 0
    max_k = 1
    current = 1
    while True:
        skip = get_skip(chars, previous_start, previous_end)
        while current < len(chars):
            if current == skip:
                current += 1
                continue
            pair = (previous_end, current)
            if pair in cache:
                k = cache[pair]
                if max_k < k:
                    max_k = k
                else:
                    current = len(chars)
            else:
                stack.append((previous_start, previous_end, current, max_k))
                previous_start = previous_end
                previous_end = current
                current = current + 1
                max_k = 1
                break
            current += 1
        else:
            if previous_end + 1 != len(chars):
                max_k += 1
            cache[(previous_start, previous_end)] = max_k
            if len(stack) == 0:
                break
            _previous_start, _previous_end, _current, _max_k = stack.pop()
            assert _current == previous_end
            assert _previous_end == previous_start
            if _max_k < max_k:
                _max_k = max_k

            previous_start = _previous_start
            previous_end = _previous_end
            current = _current
            max_k = _max_k

    return max_k


s = input()
print(count_k(list(s)))
