Skip to content

Instantly share code, notes, and snippets.

@Eric-Bro
Created February 10, 2012 15:06
Show Gist options
  • Save Eric-Bro/1790149 to your computer and use it in GitHub Desktop.
Save Eric-Bro/1790149 to your computer and use it in GitHub Desktop.
var source, result: string;
i, k, first, last, tmp: integer;
begin
readln(source);
readln(k);
first:= ORD('A');
last:= ORD('Z');
result:= source;
for i:=1 to length(source) do
begin
tmp:= ORD(source[i]) - k;
if (tmp < first) then tmp:= last - (first - tmp) + 1;
result[i]:= CHR(tmp);
end;
writeln(result);
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment