Created
November 12, 2023 11:20
-
-
Save micedreams/473fd9fac6d8015d858354483e7acd29 to your computer and use it in GitHub Desktop.
continuty wins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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