in reply to more interweaving

Hi,

Can I just ask why you are intent on reinventing the wheel here? Pairwise sequence alignment is not a trivial problem, and unless this is a 'homework' question I think you would be better off employing an already established alignment tool and then parsing the results.

Proper pairwise sequence comparison needs careful consideration of gap penalties, a scoring system for matches (preferably a scoring matrix) and a dip into the world of dynamic programming.

Have you considered using ALIGN, FASTA or BLAST and parsing the results? You may also be interested in BioPerl a set of perl modules for bioinformatics.

I apologise for not answering the question in hand, I just don't want to see you banging your head against a wall with a solution to a reasonably complex problem which may be flawed.

Bukowski - aka Dan (dcs@black.hole-in-the.net)
"Coffee for the mind, Pizza for the body, Sushi for the soul" -Userfriendly