Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

reddit #98c

By: rainman002 on Sep 15th, 2012  |  syntax: Python  |  size: 0.66 KB  |  views: 83  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. lines = []
  2. output = ''
  3. while True:
  4.     try:
  5.             lines.append(list(raw_input()))
  6.     except EOFError:
  7.             break
  8. lines = map(list, zip(*lines))
  9. numbers = {'+|+|+- -+|+|+':'0',
  10. '+|+|+':'1',
  11. '+ +|+- - -+|+ +':'2',
  12. '+ + +- - -+|+|+':'3',
  13. '+|+-+|+|+':'4',
  14. '+|+ +- - -+ +|+':'5',
  15. '+|+|+- - -+ +|+':'6',
  16. '+-+|+|+':'7',
  17. '+|+|+- - -+|+|+':'8',
  18. '+|+ +- - -+|+|+':'9',
  19. '':''}
  20. match = ''
  21. for line in lines:
  22.     for i in range(10):
  23.             line = ''.join(line).replace('||','|').replace('  ',' ').strip()
  24.     if '-' not in match or '-' not in line:
  25.             match += line
  26.     if line == '' and match in numbers:
  27.             output += numbers[match]
  28.             match = ''
  29. print output