#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
const int maxn=1000+5;
int main()
{
string a;
string b;
string temp;
map<string,string>mp;
map<string,string>::iterator it;
freopen("in.txt","r",stdin);
while(cin>>a&&a!="XXXXXX"){
temp=a;
sort(temp.begin(),temp.end());
mp[a]=temp;
}
while(cin>>b&&b!="XXXXXX"){
temp=b;
sort(temp.begin(),temp.end());
int flag=0;
for(it=mp.begin();it!=mp.end();it++){
if(it->second==temp){
flag=1;
cout<<it->first<<endl;
}
}
if(flag==0)
cout<<"NOT A VALID WORD"<<endl;
cout<<"******"<<endl;
}
}
poj乱序字典匹配(map)
最新推荐文章于 2021-02-21 10:25:40 发布