Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- #include <map>
- #include <unordered_set>
- using namespace std;
- int main() {
- char c;
- string s;
- unordered_set<string> a;
- while (true) {
- cin >> c;
- if (c == '#') {
- break;
- }
- cin >> s;
- if (c == '+') {
- a.insert(s);
- }
- if (c == '-') {
- if (a.find(s) != a.end()) {
- a.erase(s);
- }
- }
- if (c == '?') {
- if (a.find(s) != a.end()) {
- cout << "YES\n";
- } else {
- cout << "NO\n";
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement