Text this: Fast algorithm for finding mean minimum distances