let conv s =
  let rec loop prev cnt r i =
    if i = String.length s then
      r^(string_of_int cnt)^prev
    else
      begin
        let c = String.make 1 s.[i] in
        if prev = c then
          loop prev (cnt+1) r (i+1)
        else
          loop c 1 (r^(string_of_int cnt)^prev) (i+1)
      end
  in loop (String.make 1 s.[0]) 1 "" 1
;;

let () =
  let rec read () =
    let n = read_int () in
    if n = 0 then ()
    else
      begin
        let init = read_line () in
        let rec loop r = function
            0 -> r
          | i -> loop (conv r) (i-1)
        in
        Printf.printf "%s\n" (loop init n);
        read ()
      end
  in read ()
;;