Read a programming book or website describing recursive backtracking. If you don't want to use recursion, you can do the same thing with a stack instead.
Try to work it out first on paper step by step and then coding that algorithm.
The seed ADORNO=1 2 3 4 5 3, so A=1 D=2 O=3 R=4 N=5
Now I call my recursive function with position=1, meaning I am trying to find a match for 1 5 1 or ANA, this passes so I move to position=2, trying to find a match for 1 6 3 4 or A * O R and find AMOR and set M=6. Next on position 3 checking 7 3 4 8 1 or * O R * A, as I go through the list the first match is HORTA, so I will set 7=H and 8=T, this turns out to be correct but if it wasn't and a later position failed I would backtrack and try PORTA.