let words str =
  let len = String.length str in
  let buf = Buffer.create 3 in
  let rec aux i l =
    if i >= len then Buffer.contents buf :: l
    else 
      match str.[i] with
      | ' ' ->
        let s = Buffer.contents buf in
        Buffer.clear buf;
        aux (i+1) (s :: l)
      | c   ->
        Buffer.add_char buf c;
        aux (i+1) l
  in
  aux 0 []

let () =
  let _ = read_line () in
  let l = words (read_line ()) in
  print_endline (String.concat " " l)