-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabc342_c.cpp
More file actions
40 lines (34 loc) · 793 Bytes
/
Copy pathabc342_c.cpp
File metadata and controls
40 lines (34 loc) · 793 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
/** بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
* Author : Sakib62
* Created : Fri__01-Mar-2024__00:35:31
* File : C_Many_Replacement.cpp
**/
#include <iostream>
#include <unordered_map>
using namespace std;
typedef long long ll;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
string s;
cin >> s;
int q;
cin >> q;
unordered_map<char, char>mp;
for (char i = 'a'; i <= 'z'; i++) {
mp.insert({i, i}); //mp.emplace(i, i);
}
while (q--) {
char c, d;
cin >> c >> d;
for (auto i : mp) {
if (i.second == c) mp[i.first] = d;
}
}
for(auto i : s) {
cout << mp[i];
}
cout << "\n";
}