Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dmitryame/904725 to your computer and use it in GitHub Desktop.
Save dmitryame/904725 to your computer and use it in GitHub Desktop.
class String
def character_occurance
result = {}
each_char do |character|
result[character] = 0 if result[character] == nil
result[character] += 1
end
result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment