Created
March 3, 2011 19:33
-
-
Save zuchmanski/853349 to your computer and use it in GitHub Desktop.
applicake
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
chars = "6,5,2,l,2,u,7,1,t,2,4,1,1,1,1,a,6,3,@,3,b,8,7,6,o,17,1,e,15,7,m,5,1,u,13,6,.,1,3,1,d,1,r,12,3,c,3,4,s,5,1,3,1,2,p,4,5,2,p,1,3,y,13,4,k,4,5,5,i,13,3,a,18,2,c" | |
data = [] | |
chars.split(",").inject(0) do |counter, char| | |
if char == char.to_i.to_s # char looks like integer? | |
counter += char.to_i | |
else | |
data << [char, counter] # just push eg. ["R", 1] | |
counter = 0 | |
end | |
end | |
puts data.sort_by { |c| c[1] }.collect { |c| c[0] }.join # weeeee :D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment