Advertisement
myloyo

set3

Jun 7th, 2023 (edited)
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.10 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <string>
  6. #include <fstream>
  7. #include <sstream>
  8. #include <set>
  9.  
  10. using namespace std;
  11.  
  12. int main() {
  13.     string s;
  14.     getline(cin, s);
  15.     stringstream in(s);
  16.     set <string> vse;
  17.     set <string> other;
  18.     set <string> excl;
  19.     while (in >> s) {
  20.         if (s.back() == '.' or s.back() == '?') {
  21.             s.pop_back();
  22.             vse.insert(s);
  23.             for (auto str : vse) {
  24.                 other.insert(str);
  25.             }
  26.             vse.clear();
  27.         }
  28.         else if (s.back() == '!') {
  29.             s.pop_back();
  30.             vse.insert(s);
  31.             for (auto str : vse) {
  32.                 excl.insert(str);
  33.             }
  34.             vse.clear();
  35.         }
  36.         else {
  37.             vse.insert(s);
  38.         }
  39.     }
  40.  
  41.  
  42.  
  43.     for (auto x : excl) {
  44.         other.erase(x);
  45.     }
  46.  
  47.     for (auto str : other) {
  48.         cout << str << " ";
  49.     }
  50.  
  51. }
  52. What will you do? Your ARMS are in your MAGIC CHEST pooplord! You CAPTCHALOGUE them in your SYLLADEX. You are neither of these things.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement