Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 20th, 2010 | Syntax: Ruby | Size: 0.22 KB | Hits: 61 | Expires: Never
Copy text to clipboard
  1. #by vi002
  2. peoples, traffic = 0, 0
  3. while line = gets do
  4.   case line.strip
  5.     when /\+\w+/ then peoples += 1
  6.     when /\-\w+/ then peoples -= 1
  7.     when /\w+:(.+)/ then traffic += peoples * $1.size
  8.   end
  9. end
  10. puts traffic