tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
29
Task/Rot-13/Pascal/rot-13.pascal
Normal file
29
Task/Rot-13/Pascal/rot-13.pascal
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
program rot13(input, output);
|
||||
|
||||
function rot13(someText: string): string;
|
||||
var
|
||||
i: integer;
|
||||
ch: char;
|
||||
resultText: string = '';
|
||||
|
||||
begin
|
||||
for i := 1 to Length(someText) do begin
|
||||
ch := someText[i];
|
||||
case ch of
|
||||
'A' .. 'M', 'a' .. 'm': ch := chr(ord(ch)+13);
|
||||
'N' .. 'Z', 'n' .. 'z': ch := chr(ord(ch)-13)
|
||||
end;
|
||||
resultText := resultText + ch
|
||||
end;
|
||||
rot13 := resultText
|
||||
end;
|
||||
|
||||
var
|
||||
line: string;
|
||||
|
||||
begin
|
||||
while not eof(input) do begin
|
||||
readln(line);
|
||||
writeln(rot13(line))
|
||||
end
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue