What are u talking about?

转载的,进行了部分修改,原网站http://blog.csdn.net/chang_mu/article/details/38469715
#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <map>
using namespace std;
const int maxn=1e5+1;
const int inf=0x3f3f3f3f;

int main()
{
 char buf[12], s1[12], s2[12], ch;
 map<string, string> mp;
 int id = 0;
 gets(buf); //不要 START
 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())
                {
                    printf("%s", mp[buf].c_str());//为了用printf,用.c_str()
                }
                else printf("%s", buf);
   putchar(ch);//这是最后的标点符号
  }
        }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值