prefix_distance function

Calculate the prefix distance between two strings