/* * hack.cc * * Created on: Dec 21, 2011 * Author: madura */ #include #include #include #include #define forx(_start,_end) for (int i=(_start);i<(_end);i++) using namespace std; map< int, vector > table; int index(string s){ // only lower case int b=0; for (size_t i=0;i>words; forx (0,words) { string word; cin>>word; table[index(word)].push_back(word); } int count; cin>>count; forx (0,count) { string word; cin>>word; map< int, vector >::iterator it = table.find(index(word)); sort(it->second.begin(),it->second.end()); if (it != table.end()) { forx (0, it->second.size()) { cout<second[i]<<" "; } } else { cout<<"NONE"; } cout<<"\n"; } return 0; }