Код Pascal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
uses crt;
var s1,s2,z1,z2:string;
i:integer;
begin
z1:='Минск столица Беларуси';
z2:='Беларусь ты моя синеокая';
writeln('Dana stroka: ');
writeln(z1);
s1:='';
s2:='';
i:=1;
while z1[i]<>' ' do
begin
s1:=s1+z1[i];
inc(i);
end;
i:=length(z1);
while z1[i]<>' ' do
begin
s2:=z1[i]+s2;
dec(i);
end;
delete(z1,1,length(s1));
delete(z1,length(z1)-length(s2)+1,length(s2));
write (s2,z1,s1);
writeln;
writeln('Dana stroka: ');
writeln(z2);
s1:='';
s2:='';
i:=1;
while z2[i]<>' ' do
begin
s1:=s1+z2[i];
inc(i);
end;
i:=length(z2);
while z1[i]<>' ' do
begin
s2:=z2[i]+s2;
dec(i);
end;
delete(z2,1,length(s1));
delete(z2,length(z2)-length(s2)+1,length(s2));
write (s2,z2,s1);
readln;
end.