// ���� � ������ https://vk.com/pascalgroup
//�������!
{$apptype windows}
uses graphabc, abcobjects,abcbuttons, System.Drawing, System.Windows.Forms;
const disk = 'D'; // �� ������ ������� �� ���� 'C', ���� � ��� ���������� ������ , ��� ������ �������� ������ �����, �� ������� ����� ����������� ��������/�����
var
  t1, t2, t3, t4, t5, t6: TextABC;
  s1, s2: string;
  gg: integer;
  b1,b2: ButtonABC;
  r1: Rectangle;
procedure DownloadJpg; //��� ������� �������� 2-�� ��������(��� �������� ������ � ������������)
begin
 var p1: Picture;
 r1:=new Rectangle(Window.Left+20,Window.Top+245,10+Length(s2)*10,20);
 p1:=new Picture(r1);
 p1.Save(disk+':\TextEditPas\yourtextreverse.jpg');
 r1:=new Rectangle(Window.Left+20,Window.Top+165,10+Length(s2)*10,20);
 p1:=new Picture(r1);
 p1.Save(disk+':\TextEditPas\yourtext.jpg');
 Exec(disk+':\TextEditPas');
end;

begin
 //----------------------------------------------------------//
  Window.IsFixedSize:=true;                                   //
  SetWindowPos(Round(ScreenWidth/3),Round(ScreenHeight/3));    //  ��� ����� �� �������
  SetWindowSize(550, 300);                                      //
  SetWindowTitle('Text Reverse');                                //
 //---------------------------------------------------------------//
  MkDir(disk+':\TextEditPas'); 
  
  t1:=new TextABC(150, 20, 30, 'Text Reverse', clBlack); //������ ��������
  
  t2:=new TextABC(30, 100, 15, '������� �����(1-50 ��������):', clBlack); //��� �������:)
  //-------------------------------------------------------//
  repeat                                                    //
    Readln(s1);                                              //
    for var i:=1 to Length(s1) do                             //  
    begin                                                      //   ��������, �� ��������� �����, ���� �� ������ ��� ������ �� ��������, �� �� �� ����� �����
      if (s1[i] <> ' ') or (s1[i + 1] <> ' ') then              //
        gg := gg + 1;                                            //
    end;                                                          //
  until (gg = Length(s1)) and (s1 <> '') and (Length(s1) <= 50);   //
 //-----------------------------------------------------------------//
  t1.Destroy;
  t2.Destroy;
  ClearWindow(clBlack);
  
  t1:=new TextABC(150, 20, 30, 'Text Reverse', clWhite);
  
  t2:=new TextABC(30, 100, 15, '��� �����:', clWhite);
  
  t3:=new TextABC(20, 140, 13, s1, clYellow);
  
  s2:=s1;
  //----------------------------//
  for var i:=1 to Length(s1) do  //
  begin                           //    ��� ������� "���������������" ������, ������� �� ����� 
    s2[i]:=s1[Length(s1) + 1 - i]; //
  end;                              //
  //----------------------------------
  t4:=new TextABC(30, 180, 15, '��� ����������� �����:', clWhite);
  
  t5:=new TextABC(20, 220, 13, s2, clYellow);
  
  b1:=new ButtonABC(350, 250, 200, 50, '�������', clWhite);
  
  Clipboard.SetText(s2);
  
  b1.OnClick:=DownloadJpg; //��� ������� �� ������ b1("�������") ��������� ��������� (��� � ����� �����)
 
end.