Skip to content

Instantly share code, notes, and snippets.

@hoxworth
Created April 12, 2009 00:22
Show Gist options
  • Save hoxworth/93796 to your computer and use it in GitHub Desktop.
Save hoxworth/93796 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
total = 0
curr = 0
STDIN.each_byte do |char|
if char < 48
total += curr
curr = 0
else
curr = curr*10 + (char - 48)
end
end
puts total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment