
while true
	i = gets.chomp.to_i(10)
	break if i == 0
	str = gets.chomp

	i.times do
		str = str.split('').concat(["-"])
		result = ""
		c = str[0]
		len = 0

		until str.empty?
			x = str.shift
			if x == c
				len += 1
			else
				result << "#{len}#{c}"
				c = x
				len = 1
			end
		end

		str = result
	end

	puts str

end