Here’s my attempt:
bool FBullCowGame::IsIsogram(FString Word) const
{
// treat 0 and 1 letter words as isograms
if (Word.length() <= 1) { return true; }
TMap<char, bool> LetterSeen; // set up 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 do NOT have an isogram
}
else
{
LetterSeen[Letter] = true; // add the letter to the map as seen
}
}
return true;
}