But you are doing..If there is more than one possible decryption (several lines can be decoded to the key sentence), use the first line found for decoding.
Code: Select all
int findkey()
{
for(int i = lines.size() - 1; i >= 0; i--)
{
if(checkCandidate(lines[i]))
return i;
}
return -1;
}
Code: Select all
int findkey()
{
for(int i = 0; i < lines.size() ; i++)
{
if(checkCandidate(lines[i]))
return i;
}
return -1;
}
your program doesnt print the last newline..
Not so critical input:
Code: Select all
4
vtz ud xnm xugm itr pyy jttk gmv xt otgm xt xnm puk ti xnm fprxq
xnm ceuob lrtzv ita hegfd tsmr xnm ypwq ktj
frtjrpgguvj otvxmdxd prm iev prmvx xnmq
the quick brown fox jumps over the lazy dog
now is the time for all good men to come to the aid of the party
xnm ceuob lrtzv ita hegfd tsmr xnm ypwq ktj
the quick brown fox jumps over the lazy dog
programming contests are fun arent they
now is the time for all good men to come to the aid of the party
the quick brown fox jumps over the lazy dog
xnm ceuob lrtzv ita hegfd tsmr xnm ypwq ktj
programming contests are fun arent they
Code: Select all
now is the time for all good men to come to the aid of the party
the quick brown fox jumps over the lazy dog
programming contests are fun arent they
the quick brown fox jumps over the lazy dog
hcz fv oju ofeu pcr xbb mccs euh oc qceu oc oju xfs cp oju axrol
the quick brown fox jumps over the lazy dog
oju yifqd krczh pct gieav cnur oju bxwl scm
arcmrxeefhm qchouvov xru pih xruho ojul
now is the time for all good men to come to the aid of the party
the quick brown fox jumps over the lazy dog
xnm ceuob lrtzv ita hegfd tsmr xnm ypwq ktj
programming contests are fun arent they
Code: Select all
now is the time for all good men to come to the aid of the party
the quick brown fox jumps over the lazy dog
programming contests are fun arent they
the quick brown fox jumps over the lazy dog
now is the time for all good men to come to the aid of the party
xnm ceuob lrtzv ita hegfd tsmr xnm ypwq ktj
the quick brown fox jumps over the lazy dog
programming contests are fun arent they
hcz fv oju ofeu pcr xbb mccs euh oc qceu oc oju xfs cp oju axrol
oju yifqd krczh pct gieav cnur oju bxwl scm
the quick brown fox jumps over the lazy dog
arcmrxeefhm qchouvov xru pih xruho ojul