Skip to content

Instantly share code, notes, and snippets.

@micedreams
Created November 12, 2023 11:20
Show Gist options
  • Save micedreams/473fd9fac6d8015d858354483e7acd29 to your computer and use it in GitHub Desktop.
Save micedreams/473fd9fac6d8015d858354483e7acd29 to your computer and use it in GitHub Desktop.
continuty wins
input = ARGV.first.split("")
input_array = input.map(&:to_i)
output = input_array.reduce({}) do |accumulator, element|
if accumulator[element]
accumulator[element] += 1
else
accumulator[element] = 1
end
accumulator
end
puts output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment