In the pseudo code I posted, the position of X and ? are independent of each other.

It handles the 8121?2605X, just fine, finding the 9.

Although it's "pseudo code", it's as much code as pseudo code, probably.

And yes, it's all in C, when you add in the bits and pieces, it will compile!

You're welcome.