-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy path1075.cpp
46 lines (45 loc) · 868 Bytes
/
1075.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<list>
#include<map>
#include<queue>
#include<algorithm>
using namespace std;
int main()
{
char buf[12], s1[12], s2[12], ch;
map<string, string> mp;
int id = 0;
gets(buf);
while(scanf("%s%s", s1, s2), strcmp(s1, "END"))
{
mp[s2] = s1;
}
getchar();
while(scanf("%c", &ch))
{
if(isalpha(ch))
buf[id++] = ch;
else
{
buf[id] = '\0';
id = 0;
if(strcmp(buf, "END") == 0) break;
if(mp.find(buf) != mp.end())
{
cout << mp[buf]; //找到对应的就输出
}
else
printf("%s", buf); //否则输出原字符串
putchar(ch);
}
}
return 0;
}