Uses CRT; Var s1, s2 : string[50]; c : char; len, position : byte; k : word; dir : integer; Begin dir := 0; k := 0; ClrScr; TextColor(7); GotoXY(5,8); Write('Введите строку '); Readln(s1); len := length(s1) +1; ClrScr; GotoXY(10,2); Write('Stand : '); GotoXY(10,4); Write('Slide :'); GotoXY(30,10); Write('Result : '); GotoXY(30,2); Write(s1); Position := 15; c := #12; repeat if keypressed then begin c := readkey; repeat k := random(15); TextColor(k); until (k <> 8) and (k <> 0); if c = #0 then c := readkey; case c of #77 : begin if length(s2) < len -1 then Begin insert(s1[1],s2,Length(s2) + 1); delete(s1,1,1); GotoXY(20,2); ClrEOL; GotoXY(30 + (len-length(s1)-1), 2); Write(s1); GotoXY(29,4); ClrEOL; GotoXY(30,4); Write(s1); end; end; #75 : begin if length (s2) > 0 then begin insert(s2[length(s2)],s1,1); GotoXY(30 + len - length(s1)-1,2); ClrEOL; Write(s1); GotoXY(30,4); ClrEOL; Write(s1); Delete(s2,length(s2),1); end; end; end; end; GotoXY(1,12); ClrEOL; GotoXY(position,12); Write(s2); repeat k := random(1000); until k > 10; Delay (k); if position < 2 then dir := 1; if position + length(s2) > 79 then dir := 0; if dir = 0 then dec(position) else inc(position); until c = #27; TextColor(7); ClrScr; end.