def trans(str)
    res = []
    char = str[0]
    count = 1
    1.upto(str.length - 1) do |i|
        if char == str[i]
            count += 1
        else
            res << count.to_s << char
            count = 1
            char = str[i]
        end
    end
    return (res << count << char).join("")
end

while (n = gets.to_i) != 0
    str = gets.chomp
    n.times {str = trans(str)}
    puts str
end