defmodule Main do def solve("", acc), do: acc def solve(s, acc) do l = String.at(s, -1) ss = String.slice(s, 0..-2) ac = append(l, acc, String.length(acc)) solve(ss, ac) end def append(l, acc, len) when rem(len, 4) == 3 do l <> "," <> acc end def append(l, acc, _) do l <> acc end def main do s = IO.gets("") |> String.trim IO.puts solve(s, "") end end