

text='MERRYCHRISTMAS'
p=double(text)-65
clear c;
for k=1:length(text)
   c(k) = mod( 3*p(k), 26);
end

char(c+65)

clear q;
for k=1:length(text)
   q(k)=mod(9*c(k),26);
end

char(q+65)
