bool FBullCowGame::IsIsogram(FString Word) const
{
// treat 0 and 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 our word
{
Letter = tolower(Letter); // handle mixed case
// loop thru letters
// if the letter is in the map break from the loop
if (LetterSeen.find(Letter) != LetterSeen.end()) {
return false; // it isnt an isogram
}
else
{
LetterSeen.insert({ Letter, true });// add the letter to the map
}
}
return true; // weird cases like /0 always go through this test alive
}