Skip to content

Instantly share code, notes, and snippets.

@alexwebgr
Last active November 12, 2020 14:36
Show Gist options
  • Save alexwebgr/3f316b54ebd3537e0e1282615dbc2b71 to your computer and use it in GitHub Desktop.
Save alexwebgr/3f316b54ebd3537e0e1282615dbc2b71 to your computer and use it in GitHub Desktop.
str = "aabbbaa"
count = Hash.new(0)
str.each_char { |c| count[c] += 1 }
puts count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment