You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 line
290B

  1. import functools
  2. import sys
  3. text = sys.stdin.read().strip()
  4. ans1 = 0
  5. ans2 = 0
  6. for blob in text.split('\n\n'):
  7. ans1 += len(set(blob) - {'\n'})
  8. anses = [set(stuff) for stuff in blob.split('\n')]
  9. ans2 += len(functools.reduce(lambda a, b: a & b, anses))
  10. print(ans1)
  11. print(ans2)