{-#LANGUAGE BangPatterns#-}
module Main where

import Data.Functor
import Control.Monad

main::IO ()
main=do
  n<-read <$> getLine::IO Int
  when (n/=0) $
    do
      str <- getLine
      let out=times (toStr . split) str n
      putStrLn out
      main

toStr::[(Int,Char)]->String
toStr list=concatMap (\(n,c)->show n ++ [c])list

split::Eq a=>[a]->[(Int,a)]
split list=reverse $ split' 0 [] list

split'::Eq a=>Int->[(Int,a)]->[a]->[(Int,a)]
split' _ result []=result
split' !n result (x:y:ys)
  |x==y =split' (n+1) result (y:ys)
  |otherwise =split' 0 ((n+1,x):result) (y:ys)
split' !n result [x]=split' 0 ((n+1,x):result) []

times::(a->a)->a->Int->a
times _ x 0=x
times f x n=times f (f x) (n-1)