let count_repitition str =
  let len = String.length str in
  let rec count offset acc =
    if offset >= len then List.rev acc
    else
      let c = str.[offset] in
      let rec count' i r =
        if i >= len || c <> str.[i] then r
        else count' (i + 1) (r + 1) in
      let r = count' offset 0 in
      count (offset + r) ((c, r) :: acc) in
  count 0 []

let rec apply_string_operation str n =
  if n = 0 then str
  else
    let char_repititions = count_repitition str in
    let applied =
      String.concat ""
      @@ List.map
           (fun (c, r) -> (string_of_int r) ^ (String.make 1 c))
           char_repititions in
    apply_string_operation applied (n - 1)

let rec solve () =
  let n = int_of_string @@ read_line () in
  if n = 0 then ()
  else
    let applied = apply_string_operation (read_line ()) n in
    print_endline applied;
    solve ()

let () = solve ()