{电文保密
魔法世界电报局的电文保密的规律是将每个英文字母变成其后的第4个字母,如A变成E,a变成e。
最后的4个大写字母W、X、Y、Z分别变为A、B、C、D。非字母字符不变。输入一行字符,要求输出相应的密码。
}
var 
    a: string;
    i : integer;
begin
    readln(a);
    for i:=1 to length(a) do 
    begin 
        //    writeln(ord(' '));
            if( a>= 'A' )and( a[i] < 'W') then
                a[i] := chr(ord(a[i]) + 4)
            else if( a[i]>= 'W' )and( a[i] <= 'Z') then
                a[i] := chr(ord(a[i])  + 4 -26)
            else if( a>= 'a' )and( a[i] < 'w') then
                a[i] := chr(ord(a[i]) + 4)
            else if( a[i]>= 'w' )and( a[i] <= 'z') then
                a[i] := chr(ord(a[i])  + 4 -26);
    end;
    writeln(a);
end.

 

相关文章:

  • 2021-04-07
  • 2022-12-23
  • 2021-06-09
  • 2021-12-06
  • 2021-09-14
  • 2022-03-15
  • 2021-09-13
  • 2021-12-16
猜你喜欢
  • 2021-06-18
  • 2021-08-06
  • 2022-01-25
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
相关资源
相似解决方案