implementation of optimal sequence alignment (OSA) distance