It is my understanding that only the letters in the string input must be changed according to the logic of the script and other characters be retained. You may use the below script to achieve this:
function coded = hw5_problem1(txt)
coded = txt;
small = isstrprop(txt,'lower');
big = isstrprop(txt,'upper');
coded(small) = char(219-txt(small));
coded(big) = char(155-txt(big));
Hope this helps!