-
Notifications
You must be signed in to change notification settings - Fork 14
/
10115.cpp
31 lines (31 loc) · 1.21 KB
/
10115.cpp
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
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
int main(){
for(;;){
int i,n;
scanf("%d",&n);
if(n==0)
break;
char ch=getchar();
string toReplace[n],replaceBy[n],str;
for(i=0;i<n;i++){
getline(cin,toReplace[i]);
getline(cin,replaceBy[i]);
}
getline(cin,str);
for(i=0;i<n;i++){
size_t found;
found=str.find(toReplace[i]);
while(found!=string::npos){
str.replace((int)found,toReplace[i].length(),replaceBy[i]);
found=str.find(toReplace[i]);
}
}
cout<<str<<endl;
}
return 0;
}