Dynamic programming of affine-gap model for aligning DNA and protein sequences