# -*- coding: UTF-8 -*-
import re


regex = r'(.{2,}?)(\1)+'
expr = re.compile(regex)


def repl(matched):
    v0 = matched.group()
    v2 = matched.group(2)
    return str(len(v0) / len(v2)) + '['+ v2 + ']'


def encode(string):
    if string :
        encoded = re.sub(expr, repl, string)
        if len(string) > len(encoded):
            encoded = encode(encoded)
        else:
            return string
        return encoded
    else:
        print 'None string'

    
if __name__ == '__main__':
    str1 = input('input encoding string')
    print encode(str1)