bool FBullCowGame::IsIsogram(FString Word) const
{
// treat 0 ans 1 letter words as isograms
if (Word.length() <= 1) { return true; }
TMap<char, bool> LetterSeen; // setup our map
for (auto Letter : Word) // for all letters of the word
{
Letter = tolower(Letter); // handle mixed case
if (LetterSeen[Letter]) // if the letter is in the map
{
return false; // we don't have an isogram
}
else // otherwise
{
LetterSeen[Letter] = true; // add the letter to the map as seen
}
}
return true;
}
Looks good to me.