#Pyth, (削除) 20 (削除ここまで) 24 bytes#
Pyth, (削除) 20 (削除ここまで) 24 bytes
My first attempt on Pyth :)
Jcw;FG.ptJI:hJj".*"G0jdG
How it works:
Jcw;FG.ptJI:hJj".*"G0jdG
Jcw assign("J",chop(input()))
FG.ptJ for G in permutations(tail(J)):
I:hJj".*"G0 if match(head(J),join(".*",G)):
jdG print(join(" ",G))
Notes: it takes a long time in the third example (dababbabadbaccbcbaaacdacdbdd aa bb cc dd ba ba ba ab ac da db dc).
#Pyth, (削除) 20 (削除ここまで) 24 bytes#
My first attempt on Pyth :)
Jcw;FG.ptJI:hJj".*"G0jdG
How it works:
Jcw;FG.ptJI:hJj".*"G0jdG
Jcw assign("J",chop(input()))
FG.ptJ for G in permutations(tail(J)):
I:hJj".*"G0 if match(head(J),join(".*",G)):
jdG print(join(" ",G))
Notes: it takes a long time in the third example (dababbabadbaccbcbaaacdacdbdd aa bb cc dd ba ba ba ab ac da db dc).
Pyth, (削除) 20 (削除ここまで) 24 bytes
My first attempt on Pyth :)
Jcw;FG.ptJI:hJj".*"G0jdG
How it works:
Jcw;FG.ptJI:hJj".*"G0jdG
Jcw assign("J",chop(input()))
FG.ptJ for G in permutations(tail(J)):
I:hJj".*"G0 if match(head(J),join(".*",G)):
jdG print(join(" ",G))
Notes: it takes a long time in the third example (dababbabadbaccbcbaaacdacdbdd aa bb cc dd ba ba ba ab ac da db dc).
#Pyth, 20(削除) 20 (削除ここまで) 24 bytes#
My first attempt on Pyth :)
Jcw;FG.ptJIqjkGhJjdGptJI:hJj".*"G0jdG
How it works:
Jcw;FG.ptJI:hJj".*"G0jdG
Jcw assign("J",chop(input()))
FG.ptJ for G in permutations(tail(J)):
I:hJj".*"G0 if match(head(J),join(".*",G)):
jdG print(join(" ",G))
Notes: it takes a long time in the third example (dababbabadbaccbcbaaacdacdbdd aa bb cc dd ba ba ba ab ac da db dc).
#Pyth, 20 bytes#
My first attempt on Pyth :)
Jcw;FG.ptJIqjkGhJjdG
#Pyth, (削除) 20 (削除ここまで) 24 bytes#
My first attempt on Pyth :)
Jcw;FG.ptJI:hJj".*"G0jdG
How it works:
Jcw;FG.ptJI:hJj".*"G0jdG
Jcw assign("J",chop(input()))
FG.ptJ for G in permutations(tail(J)):
I:hJj".*"G0 if match(head(J),join(".*",G)):
jdG print(join(" ",G))
Notes: it takes a long time in the third example (dababbabadbaccbcbaaacdacdbdd aa bb cc dd ba ba ba ab ac da db dc).