procedure TForm1.Button1Click(Sender: TObject);
type dalphabets=array[1..26] of char;
     xalphabets=array[1..26] of char;
var
    word:char;
    i,total,k,ascword,numberword,examine:integer;
    text,password:string;
begin
  password:='';
  text:=edit1.Text;
  total:=length(text);
  for i:=1 to 26 do
  begin
    dalphabets(i):=chr(i+96);
    xalphabets(i):=chr(i+64);

  end;
  for i:=1 to total do
  begin
    word:=copy(text,i,1);
    k:=1 mod 5;
    ascword:=ord(word);
    if k=0 then k:=5;
    if strtoint(word) in [0..9] then
    begin
      numberword:=strtoint(word);
      numberword:=numberword+k;
      if numberword>9 then numberword:=numberword-10;
      password:=password+inttostr(numberword);
    end
    else if ascword in[97..127] then
    begin
      for examine:=1 to 26 do
      begin
        if xalphabets(examine)=word then continue;
      end;
      examine:=examine+k;
      if examine>26 then examine:=examine-26;
      password:=password+xalphabets(examine);
    else if ascword in[65..90] then
    begin
      for examine:=1 to 26 do
      begin
        if dalphabets(examine)=word then continue;
      end;
      examine:=examine+k;
      if examine>26 then examine:=examine-26;
      password:=password+dalphabets(examine);
    end
    else
      password:=password+word;
    end;
  end;
  edit2.Text:=password;
end;