defmodule Solution do line = "10 12 50 20 20 10" #line = IO.read :stdio, :all [a1, a2, a3, b1, b2, b3] = String.split line initial_points = %{alice: 0, bob: 0} points_round_one = case a1 > b1 do true -> %{initial_points | alice: initial_points.alice + 1} false -> %{initial_points | bob: initial_points.bob + 1} end IO.inspect points_round_one points_round_two = case a2 == b2 do true -> points_round_one false -> case a2 < b2 do true -> %{points_round_one | alice: points_round_one.alice + 1 } false -> %{points_round_one | bob: points_round_one.bob + 1 } end end IO.inspect points_round_two points_round_three = case a3 < b3 do true -> %{points_round_two | alice: points_round_two.alice + 1} false -> %{points_round_two | bob: points_round_two.bob + 1} end IO.inspect points_round_three alice = Map.get(points_round_three, :alice) bob = Map.get(points_round_three, :bob) IO.write(alice) IO.write(" ") IO.write(bob) end