Created
March 25, 2014 13:17
-
-
Save plindberg/9761609 to your computer and use it in GitHub Desktop.
Count occurrences of S, M, L, X in a string
This file contains hidden or 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
`pbpaste`.split(',').sort_by{|x|'SMLX'.index(x)}.inject({}){|h,x|h[x]=(h[x]||0)+1;h} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment