fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. vector<string> badwords;
  9. badwords[0] = "broccoli";
  10. badwords[1] = "aglio";
  11. badwords[2] = "pollo";
  12.  
  13. vector<string> words;
  14. string word;
  15.  
  16. while (cin >> word)
  17. {
  18. words.push_back(word);
  19. }
  20.  
  21. for (unsigned int i1 = 0; i1 < words.size(); i1++) //index that cycles through inputted words
  22. {
  23. for (unsigned int i2 = 0; i2 < badwords.size(); i2++) //index that cycles through bad words
  24. {
  25. if (words[i1] == badwords[i2]) // check if word[i1] equals a badword
  26.  
  27. {
  28. words[i1] = "BLEEP";
  29. }
  30. }
  31.  
  32. }
  33.  
  34. for (unsigned int i3 = 0; i3 < words.size(); i3++) // cycle through every word now filtered and print them on screen
  35. {
  36. cout << words[i3] << "\n";
  37. }
  38.  
  39. return 0;
  40. }
  41.  
Runtime error #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty