-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB_Lecture.cpp
More file actions
53 lines (40 loc) · 904 Bytes
/
B_Lecture.cpp
File metadata and controls
53 lines (40 loc) · 904 Bytes
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#include "debugger.cpp"
#else
#define debug(...)
#define debugArr(...)
#endif
int main () {
using namespace std;
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
// vector<pair<string, string>> s(m);
vector<string> s(m * 2);
for (int i = 0; i < m * 2; i += 2) {
string a, b;
cin >> a >> b;
if (b.size() < a.size()) {
swap(a, b);
}
s[i] = a;
s[i + 1] = b;
// s[i] = make_pair(a, b);
}
vector<string> t(n);
for (string& c : t) {
cin >> c;
for (int i = 0; i < s.size(); i += 2) {
if (c == s[i]) {
break;
} else if (c == s[i + 1]) {
c = s[i];
break;
}
}
cout << c << " ";
}
return 0;
}