I have a list like this, say for example the list name is output
which has:
[[[o, g], [g, o]], [[o, g, o, d]], [[o, d]], [[t, s, n, e, e, e, n, c, s]], [[t, s, n, e, e]], [[e, n, c, s]]]
And I have a input like this, say input
is:
ogodtsneeencs
Now obviously, the input
can be formed from output
. I tried the subsequences()
of output
to find the possible combinations that form the input
, but the thing is it wont work for all the input
.
Can anyone say me how I can find the combinations of output
that will be equal to input
? And possibly store in some list
.
Thanks in advance.
Given just this small set of test data you have supplied, I came up with this:
Which prints out:
Without more data, it's hard to tell if it is correct, but it might be a good starting place for you
edit
Updated to return all permutations of the valid tokens