Test instructions: Give a dictionary, and a word, translate a bit
Strange format
Sample inputstartfrom Fiwohello difhmars riwosfearth fnnvklike fiiwjendstartdifh, i ' m fiwo riwosf.i fiiwj fnnvk! END Sample Outputhello, I ' m from mars.i like earth!
1#include <cstdio>2#include <iostream>3#include <algorithm>4#include <cstring>5#include <cmath>6#include <queue>7#include <map>8 using namespacestd;9 #defineMOD 1000000007Ten Const Doubleeps=1e-5; One #defineCL (a) memset (A,0,sizeof (a)) A #defineTS printf ("*****\n"); - Const intmaxn=1005; -map<string,string>MP; the intN,m,tt; - intMain () - { - inti,j,k; + #ifndef Online_judge -Freopen ("1.in","R", stdin); + #endif A stringstr1,str2; atCin>>str1; - while(cin>>str1) - { - if(str1=="END") Break; -Cin>>str2; -mp[str2]=str1; in } -Cin>>str1; to Charch; +Ch=GetChar (); -str1=""; the while(1) * { $ while(1)Panax Notoginseng { -scanf"%c",&ch); the if(! ((ch>='a'&&ch<='Z')|| (ch>='A'&&ch<='Z'))) Break; +str1+=ch; A } the if(str1=="END") Break; + if(Mp.find (STR1) ==mp.end ()) cout<<str1;//not found in the dictionary - Elsecout<<MP[STR1]; $str1=""; $printf"%c", ch);//symbol or Space - } - return 0; the}
HDU 1075 Map