defmodule Main do def main do {n, _} = IO.read(:line) |> Integer.parse() (n + 1) |> solve |> IO.puts() end def solve(n), do: solve_rec(n, []) |> Enum.reverse() |> Enum.join() @alphabet ?A..?Z |> Enum.map(&[&1]) |> Enum.map(&to_string/1) @base @alphabet |> length def solve_rec(n, x) when n <= @base, do: [(n - 1) |> to_alphabet | x] def solve_rec(n, x), do: solve_rec(n |> div(@base), [((n |> rem(@base)) - 1) |> to_alphabet | x]) def to_alphabet(n), do: @alphabet |> Enum.at(n) end