map<int, vector<string>> all;
void show()
{
for (map<int, vector<string>>::iterator it= all.begin(); it != all.end();++it)
{
vector<string> tempStr = (*it).second;
if (tempStr.size() > 2)
{
for (int i = 0;i < tempStr.size(); ++i)
{
cout<<tempStr[i]<<endl;
}
}
else
{
cout<<"No solution"<<endl;
}
}
}
void finderDoublet(vector<string>&aVect,map<string,string>&aMap)
{
int tempIndex = 0;
vector<string>vectstr;
for (map<string,string>::iterator it = aMap.begin();it != aMap.end();++it,++tempIndex)
{
vectstr.clear();
vectstr.push_back((*it).first);
vectstr.push_back((*it).second);
string tempA = (*it).first;
for (int i = 0;i < aVect.size();++i)
{
string temp = aVect[i];
if ((*it).first.find(temp) != string::npos)
{
continue;
}
if ((*it).second.find(temp) != string::npos)
{
continue;
}
int k = 0;
for (int j = 0;j < temp.length();++j)
{
if (tempA[j] != temp[j])
{
k++;
}
if (k > 1)
{
break;
}
}
if (k == 1)
{
vectstr.insert(vectstr.begin()+1,temp);//这儿出来的结果一样,就是和用例上顺序不一样
tempA = temp;
}
}
all.insert(pair<int, vector<string>>(tempIndex,vectstr));
}
}