Skip to content

Instantly share code, notes, and snippets.

@zuchmanski
Created March 11, 2011 13:15
Show Gist options
  • Save zuchmanski/865865 to your computer and use it in GitHub Desktop.
Save zuchmanski/865865 to your computer and use it in GitHub Desktop.
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"
result, counter = [], 0
chars.split(",").each do |char|
if char == char.to_i.to_s # char looks like integer?
counter += char.to_i
else
result[counter - 1] = char
counter = 0
end
end
puts result.join # weeeee :D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment