I think you shoud make all possible mutations for the mautated sequences, and see wich ones are present in all the sets of mutations(from mustations). I'l try to code it and post back.
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <string>
usingnamespace std;
int main()
{
string bla[]={"132", "213", "231", "312", "132"};
vector<string> niz(bla, bla+5);
vector<vector<string> > mut;
int i, j, k;
mut.reserve(5);
for (i=0; i<5; i++)
{
for (j=0; j<3; j++)
{
for (k=0; k<3; k++)
{
if (j!=k)
{
string temp=niz[i];
temp.insert(k, 1, temp[j]);
temp.erase(j+1, 1);
mut[i].push_back(temp);
}
}
}
}
for (i=0; i<mut[0].size(); i++)
{
bool a=true;
string b=mut[0][i];
for (j=1; j<5; j++)
{
if (mut[j][i]!=b) a=false;
}
if (a)
{
cout<<mut[i][0]<<endl;
break;
}
}
system ("pause");
return 0;
}
But, it only runs in debug mode(if I run it normally it says "this application has caused a runtime error..." etc. yadda yadda yadda, andit never finds a match. What's the problem?
Can you explain me what have you done?
If you write mut.resize(5) instead of mut.reserve(5) it works, but it doesn't print any solution and i didn't understand what you wrote.