fork download
  1. #include <algorithm>
  2. #include <cstdlib>
  3. #include <iostream>
  4. #include <iterator>
  5. #include <string>
  6.  
  7. int main(int argc, char* argv[])
  8. {
  9. using namespace std;
  10.  
  11. string word;
  12. cin >> word; // word to search
  13. istream_iterator<string> words(cin), eof;
  14. bool found = find(words, eof, word) != eof;
  15. return found ? 0 : (cin.eof() ? 1 : 2);
  16. }
Runtime error #stdin #stdout 0s 4244KB
stdin
word
spam  spam
spam
stdout
Standard output is empty