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.

15 lines
413B

  1. import sys
  2. w, h = 25, 6
  3. text = sys.stdin.read()
  4. count = lambda m: lambda layer: sum(n == m for n in layer) # noqa
  5. layers = list(zip(*[(int(n) for n in text.strip())] * w * h))
  6. min_layer = min(layers, key=count(0))
  7. print(count(1)(min_layer) * count(2)(min_layer))
  8. px = (' #'[next(n for n in stack if n != 2)] for stack in zip(*layers))
  9. print('\n'.join(''.join(next(px) for _ in range(w)) for _ in range(h)))