minimum distance between two characters in a string