Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <map>
  6. #include <unordered_set>
  7. using namespace std;
  8. int main() {
  9. char c;
  10. string s;
  11. unordered_set<string> a;
  12. while (true) {
  13. cin >> c;
  14. if (c == '#') {
  15. break;
  16. }
  17. cin >> s;
  18. if (c == '+') {
  19. a.insert(s);
  20. }
  21. if (c == '-') {
  22. if (a.find(s) != a.end()) {
  23. a.erase(s);
  24. }
  25. }
  26. if (c == '?') {
  27. if (a.find(s) != a.end()) {
  28. cout << "YES\n";
  29. } else {
  30. cout << "NO\n";
  31. }
  32. }
  33. }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement