The input consists of an array of words that may contain repetitions. The word endOfInput
denotes the end of input array and is not
to be considered a member of the array. The array is followed by a single word v
. Write a program whose output is Yes
or No
depending on whether \(v\) is a member of the input array.
Your code should replace the text // ??? //
below.
#include<iostream> #include<set> int main(){ std::set<std::string> allWords; std::string wordFromUser; std::cin>>wordFromUser; while(wordFromUser!="endOfInput"){ allWords.insert(wordFromUser); std::cin>>wordFromUser; } std::string v; std::cin>>v; // ??? // return 0; }