Question: what wrong with my code?

The question is“fsqFsHn sGGousG” is the result of applying a Caesar cipher to its original title. A 53-character alphabet
consisting of all the upper-case letters, a space, and all the lower-case letters
was used; consequently the space in the middle might or might not correspond to a
space in the title. Determine what the original title was.

this is what I wrote: (please help me correct it, thank you)

>Alphabet:="ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz";

>ListToString:=proc(numlist::list(nonnegint))
global Alphabet;
cat(seq( Alphabet[numlist[i]+1]  , i=1..nops(numlist)));
end proc:

>StringToList:= proc(text::string)
global Alphabet:
[seq(SearchText(text[i],Alphabet)-1    , i=1..length(text) )];
end proc:

>Caesar:=proc(plaintext::string,shift::integer)
local mytext,mycode,i,p;
global Alphabet;
p:=length(Alphabet);
mytext:=StringToList(plaintext);
mycode:=[seq(modp(mytext[i]+shift,p),i=1..length(plaintext))];
ListToString(mycode);
end proc:

>Caesar(“"fsqFsHn sGGousG"”,53)
 

 

 

Please Wait...