Skip to content

Commit

Permalink
Add Elixir/narze.ex
Browse files Browse the repository at this point in the history
  • Loading branch information
narze committed Oct 8, 2021
1 parent 9b433f7 commit 94ccd62
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Elixir/narze.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Usage: elixir Elixir/narze.ex

input = "Coffee"

output =
input
|> String.split("")
|> Enum.reverse()
|> Enum.map(fn char ->
case char do
"C" -> "e"
"o" -> "d"
"f" -> "o"
_ -> "C"
end
end)
|> Enum.uniq()
|> Enum.join()

"Input: #{input}" |> IO.puts()
"Output: #{output}" |> IO.puts()

0 comments on commit 94ccd62

Please sign in to comment.