알고리즘/Backjoon
[C++] 7785 - 회사에 있는 사람
ShinDongJun
2019. 12. 5. 11:34
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include <bits/stdc++.h>
#include<iostream>
#include<map>
#include<utility>
#include<algorithm>
#include<set>
#include<string>
#define endl '\n';
using namespace std;
set<string> s;
int main(void)
{
ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int n;
string name;
string log;
cin >> n;
for(int i = 0; i < n; ++i)
{
cin >> name >> log;
if(!log.compare("enter"))
s.insert(name);
else
s.erase(name);
}
for(set<string>::reverse_iterator iter = s.rbegin(); iter != s.rend(); ++iter)
cout << *iter << endl;
return 0;
}
|