Skip to content

Instantly share code, notes, and snippets.

@pieter
Created November 2, 2011 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pieter/1334031 to your computer and use it in GitHub Desktop.
Save pieter/1334031 to your computer and use it in GitHub Desktop.
p DATA.read.split.inject(0) { |x,y| x + (y =~ /(\d+)-(\d+)/ ? ($2.to_i - $1.to_i + 1) : 1) }
__END__
1-99
101-108
177
214
241
259
323
361
388-389
402
412
414-416
420
425
429-432
435-442
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment