def change_str(str)
    current_chr = str[0]
    continue_count = 1
    new_string = ""
    (1..str.length).each do |index|
        break if index >= str.length
        if current_chr != str[index]
            new_string += current_chr + continue_count.to_s
            continue_count = 1
            current_chr = str[index]
            else
            continue_count += 1
        end
    end
    new_string += current_chr + continue_count.to_s
    new_string
end

while str = gets do
    num = str.chomp.to_i
    break if num == 0
    str = gets.chomp
    num.times do |n|
        str = change_str(str)
    end
    puts str.reverse
end