ADFGVX cipher: Difference between revisions

Content added Content deleted
m (Minor code improvement.)
Line 1,716: Line 1,716:
std::string word;
std::string word;
while ( file_stream >> word ) {
while ( file_stream >> word ) {
if ( word.length() == size &&
std::transform(word.begin(), word.end(), word.begin(), [](const char& ch){ return std::toupper(ch); });
if ( word.length() == size
word.length() == std::unordered_set<char>{ word.begin(), word.end() }.size() ) {
&& word.length() == std::unordered_set<char>{ word.begin(), word.end() }.size()
std::transform(word.begin(), word.end(), word.begin(), [](const char& ch){ return std::toupper(ch); });
&& word.find_first_not_of(ALPHABET) == std::string::npos ) {
if ( word.find_first_not_of(ALPHABET) == std::string::npos ) {
candidates.emplace_back(word);
candidates.emplace_back(word);
}

}
}
}
}