#include <map>
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
map<string,string>node;
string s,t;
int main()
{
    while(cin>>s&&s!="XXXXXX")
    {
        t=s;
        sort(s.begin(),s.end());// 利用sort对string里面的东西排序 减少全排列的问题
        node.insert(make_pair(t,s));
    }
    while(cin>>s)
    {
        int  flag=1;
        if(s=="XXXXXX")
            break;
        sort(s.begin(),s.end());
        map<string,string>::iterator it;
        for(it=node.begin();it!=node.end();it++)
        {
            if(it->second==s)
            {
                flag=0;
                cout<<it->first<<endl;
            }
        }
        if(flag)
            cout<<"NOT A VALID WORD"<<endl;
        cout<<"******"<<endl;
    }
    return 0;
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-13
  • 2021-10-01
  • 2021-12-25
  • 2021-10-27
  • 2022-12-23
  • 2021-11-24
  • 2021-12-23
相关资源
相似解决方案