defmodule Main do def getsAll(device \\ :stdio, prompt), do: getsAll(device, prompt, "") defp getsAll(device, prompt, input) do x = IO.gets(device, prompt) case x do {:error, _} -> x :eof -> input _ -> getsAll(device, prompt, input <> x) end end def main do inputs = getsAll(nil) |> String.split [a, b] = inputs |> Enum.slice(0..1) |> Enum.map(&(String.to_integer(&1))) s = inputs |> Enum.slice(2..-1) IO.puts Enum.join([a + b, s], " ") end end