Standard C++ Library User Guide and Tutorial

void findMisspell(stringset & words, string & word)
{
for (int i = 1; i < word.length(); i++) {
swap(word[i-1], word[i]);
if (words.count(word))
cout << "Suggestion: " << word << endl;
// put word back as before
swap(word[i-1], word[i]);
}
}