Well, I don't know what local/global alignment in DNA terms is. You posted two strings and a final output, but I have no idea what the algorithim or criteria is for acheiving the final output based on the input. Have you ever looked into bioperl?
Main Page - BioPerl