In two non-related sentences all the words were replaced each by a couple of numbers separated by a slash:
1st sent:,,,,,,, 23/2 26/3 28/2 98/5
2nd sent: .....56/4 31/4 28/2 79/4 31/4
The 1st number stands for the sum of numerical values of the English ABC (A=1,B=2,...Z=26) and the 2nd specifies the number of letters,
e.g. the sentence I LOVE YOU would be represented by 9/1 54/4 61/3
Please restore the original phrases.
1) in god we trust
2) this land is your land
I used the following Mathematica code to take a cypber and give a list of possible english words for each of the words in the sentence. I then was able to quickly determine what the sentences were by starting with the words that had the fewest choices and building out from there.
code = {{56, 4}, {31, 4}, {28, 2}, {79, 4}, {31, 4}};
clng = Length[code];
let = Table[i, {i, 1, 26}];
For[ci = 1, ci <= clng, ++ci,
s = code[[ci, 1]];
n = code[[ci, 2]];
sols = Select[Tuples[let, n], Total[#] == s &];
lng = Length[sols];
rlst = Table[
FromCharacterCode[Table[96 + sols[[i, j]], {j, 1, n}]], {i, 1,
lng}];
wlst = Select[rlst, Length[DictionaryLookup[#]] != 0 &];
Print[wlst];
];
|
Posted by Daniel
on 2015-07-27 14:04:59 |