package paiza

object Main{
  def main(args:Array[String]){
    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):List[Int] = {
          line match{
            case Nil => 0::List(prev)
            case (h::t) if h == prev =>
              val (hn::tn) = convert(t, h)
              (hn + 1)::tn
            case (h::t) => 
              val (hn::tn) = convert(t, h)
              0::prev::(hn + 1)::tn
          }
        }
        def loop(line:List[Int], count:Int):List[Int] = {
          count match{
            case 0 => line
            case _ => 
              val (h::t) = line
              loop(convert(line, h), count -1)
          }
        }
        println(loop(target, n).foldLeft("")(_ + _.toString))
        go
      }
    }
    go
  }
}