
import scala.io.StdIn._

object Main {
  def main(args: Array[String]): Unit = {
    while (true) {
      val n = readInt
      if (n == 0) return
      var value = readLine
      for (i <- 0 until n) {
        value = Some(value.split("").toList).map(encode).map(toString).getOrElse("")
      }
      println(value)
    }
  }

  def pack[T](list: List[T]): List[List[T]] = list match {
    case Nil => Nil
    case x :: xs1 =>
      val (first, rest) = list span (y => y == x)
      first :: pack(rest)
  }

  def encode[T](list: List[T]): List[(T, Int)] =
    pack(list) map (ys => (ys.head, ys.length))

  def toString(list: List[(String, Int)]):  String = {
    list.map(x => x._2 + x._1).mkString
  }

}

