complete basic string distance