import scala.io.StdIn.{readInt,readLine}

object Main extends App {
  def genStr(s:String) = {
    var i = 0
    var result = ""

    while(i<s.length) {
      var c = s(i)
      var j = i
      var cnt = 0
      while(j<s.length && s(i)==s(j)) { j+=1;cnt+=1 }
      result += cnt.toString+s(i)
      i = j
    }
    result
  }
  Iterator.continually(readInt).takeWhile(_!=0).foreach { n =>
    var s = readLine
    (0 until n).foreach { _ => s = genStr(s) }
    println(s)
  }
}