    object Main{
      def main(args:Array[String]):Unit = {
     
        def go():Unit = {
          val n = io.StdIn.readLine.toInt
          if (n != 0){
            val target = (for (c <- io.StdIn.readLine) yield c.toString.toInt).toList
            def convert(line:Seq[Int], prev:Int, res:List[Int]):List[Int] = {
              val (hn::tn) = res
              //println(res, line, prev)
              line match{
                case Nil => (prev::(hn)::tn).reverse
                case (h::t) if h == prev =>
                  convert(t, h, (hn + 1)::tn)
                case (h::t) => 
                  convert(t, h, 1::prev::(hn)::tn)
              }
            }
            def loop(line:List[Int], count:Int):List[Int] = {
              count match{
                case 0 => line
                case _ => 
                  val (h::t) = line
                  loop(convert(line, h, 0::Nil), count -1)
              }
            }
            loop(target, n).foreach(print(_))
            println()
            go
          }
        }
        go
      }
    }