C++ implementation of Levenshtein distance