SetDirectory["/home/faculty/struther/public_html/Courses/5903/Encryption"]
PlainTextBig=ToLowerCase[Import["11.txt"]];
PlainText=StringCases[PlainTextBig,{LetterCharacter,Whitespace->" "}];
PlainText=Drop[PlainText,-1];
Short[PlainText,30]

TableForm[Sort[Tally[PlainText]]]
Length[PlainText]

SplitPlainText=Transpose[Partition[PlainText,3]];
Alphabet=Join[CharacterRange["a","z"],{" "}];
NewAlphabets =Table[RandomSample[Alphabet,27],{3}];
Subs=Table[
MapThread[Rule, {Alphabet, NewAlphabets[[i]]}],
{i,3}]

Encrypted=StringJoin[
Flatten[
Transpose[
Table[
SplitPlainText[[i]]/.Subs[[i]],
{i,3}]
]
]
];
Export["Encrypt.txt",Encrypted]