def compress(text, tok_len):
    words = [text[i:i + tok_len] for i in range(0, len(text), tok_len)]
    res = []
    cnt = 1
    cur_word = words[0]
    for a, b in zip(words, words[1:] + ['']):
        if a == b:
            cnt += 1
        else:
            res.append([cur_word, cnt])
            cur_word = b
            cnt = 1
    return sum(len(a) + (len(str(b)) if b > 1 else 0) for a, b in res)
def solution(s):
    return min(compress(s, token) for token in list(range(1, int(len(s)/2) + 1)) + [len(s)])