#!/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

while (n = gets.chomp.to_i) != 0
  num = gets.chomp
  n.times do
    num = alg(num)
  end
  puts num
end