for _ in range(8): x=0, for n in input():x=[t-n+1for t in x]+[n*len(x)] print x
0, 0, 0 0, 0, 1 0, 1, 0 0, 1, 1 1, 0, 0 1, 0, 1 1, 1, 0 1, 1, 1
[3, 2, 1, 0] [2, 1, 0, 3] [2, 1, 3, 0] [1, 0, 2, 3] [2, 3, 1, 0] [1, 2, 0, 3] [1, 2, 3, 0] [0, 1, 2, 3]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!