fork download
  1. from itertools import*
  2. j=''.join
  3. def f(x):
  4. for l in count(1):
  5. for i in product(x,repeat=l):
  6. *b,=zip(*i);c=j(b[0])
  7. if c==j(b[1]):print(c,j(str(x.index(k)+1)for k in i));return
  8.  
  9. f((('0','110'),('11','1'),('001','100')))
Success #stdin #stdout 0.02s 9984KB
stdin
Standard input is empty
stdout
11110 221