diff --git a/lab2/dictionary.cc b/lab2/dictionary.cc index 0245fe4..6747a69 100644 --- a/lab2/dictionary.cc +++ b/lab2/dictionary.cc @@ -12,7 +12,15 @@ using std::vector; Dictionary::Dictionary() {} -bool Dictionary::contains(const string &word) const { return true; } +bool Dictionary::contains(const string &word) const { + int l = word.length(); + Word w = Word(word); + if (std::find(this->words[l].begin(), this->words[l].end(), w) != + std::end(this->words[l])) { + return true; + } + return false; +} vector Dictionary::get_suggestions(const string &word) const { vector suggestions;