| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
0ms。。。。#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<numeric>
#include<cmath>
#include<bitset>
#include<set>
#include<queue>
#include<iterator>
#include<limits>
#include<map>
using namespace std;
int main(int argc, char* argv[])
{
map<string,string> dictionary;
string str,tmp;
bool flag;
string s1 = "******";
map<string,string>::iterator it;
while(cin>>str)
{
if(str == "XXXXXX")
break;
tmp = str;
sort(tmp.begin(),tmp.end());
dictionary.insert(make_pair(str,tmp));
}
while(cin>>str)
{
if(str == "XXXXXX")
break;
sort(str.begin(),str.end());
//it = dictionary.find(str);
//if(it != dictionary.end())
flag = false;
for(it = dictionary.begin(); it != dictionary.end(); ++it)
{
if(it->second == str)
{
flag = true;
cout<<it->first<<endl;
}
}
if(flag == true)
{
cout<<s1<<endl;
}
else
{
cout<<"NOT A VALID WORD"<<endl;
cout<<s1<<endl;
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator