#!/usr/bin/ruby
def alg(num)
  ans = ''
  bn = ''
  cn = 0
  num.to_s.split('').each do |n|
    if bn == ''
      bn = n
      cn = 1
      next
    end

    if n == bn
      cn += 1
    else
      ans << cn.to_s
      ans << bn
      bn = n
      cn = 1
    end
  end
  ans << cn.to_s
  ans << bn
  ans
end


str = ''
File.open('input.txt') do |file|
  while (n = file.readline.chomp.to_i) != 0
    num = file.readline.chomp
    n.times do
      num = alg(num)
    end
    str << "#{num}\n"
  end
end

File.open('output.txt', 'w') do |file|
  file.write str
end