Program one_a;
uses crt;
var s1,s2:string;
p,a:integer;
begin
readln(s1);
readln(s2);
p:=pos(s2,s1);
if p=0 then writeln('no')
else writeln('pos:',p);
end.
Program one_b;
uses crt;
var s1,s2:string;
p,a:integer;
begin
readln(s1);
readln(s2);
p:=pos(s2,s1);
if p=0 then writeln('no')
else
begin
a:=length(s2);
delete(s1,p,a);
writeln(s1);
end;
end.
Program one_c;
uses crt;
var s1,s2:string;
p:integer;
begin
readln(s1);
readln(s2);
s2:=' '+s2+' ';
readln(p);
insert(s2,s1,p);
writeln(s1);
end.
Program two_a;
uses crt;
var s1,s2,s3:string;
begin
s1:='край озер ';
writeln(s1);
s2:='лесов и рек';
writeln(s2);
insert(s2,s1,length(s1)+1);
writeln(s1);
end.
Program two_b;
uses crt;
var s1,s2,s3:string;
p,a:integer;
begin
s1:='Я учусь в школе';
writeln(s1);
s2:='в школе';
s3:='в 10-м классе';
p:=pos(s2,s1);
a:=length(s2);
delete(s1,p,a);
insert(s3,s1,p+1);
writeln(s1);
end.
Program three_a;
uses crt;
var s1,s2:string;
p,a:integer;
begin
s1:='моя родина Беларусь';
writeln(s1);
s2:='Беларусь';
p:=pos(s2,s1);
a:=length(s2);
delete(s1,p,a);
s1:=s2+' '+s1;
writeln(s1);
end.
Program three_b;
uses crt;
var s1,s2:string;
p,a:integer;
begin
s1:='люблю цябе, мой родны кут';
writeln(s1);
s2:='мой родны кут';
p:=pos(s2,s1);
a:=length(s2);
delete(s1,p,a);
delete(s1,length(s2)-2,2);
s1:=s2+','+s1;
writeln(s1);
end.
Program four_a;
uses crt;
var s1,s2,s3:string;
p,k,i,l,m:integer;
begin
s1:='Минск столица Беларуси';
writeln(s1);
k:=0;
for i:=1 to length(s1) do
if copy(s1,i,1)=' ' then
begin
inc(k);
l:=i;
end;
p:=pos(' ',s1);
s2:=copy(s1,1,p-1);
s3:=copy(s1,l+1,length(s1)-l+1);
k:=length(s2);
m:=length(s3);
delete(s1,1,k);
delete(s1,l-p+2,m);
s1:=s3+s1+s2;
writeln(s1);
end.
Program four_b;
uses crt;
var s1,s2,s3:string;
p,k,i,l,m:integer;
begin
s1:='Беларусь ты моя синеокая';
writeln(s1);
k:=0;
for i:=1 to length(s1) do
if copy(s1,i,1)=' ' then
begin
inc(k);
l:=i;
end;
p:=pos(' ',s1);
s2:=copy(s1,1,p-1);
s3:=copy(s1,l+1,length(s1)-l+1);
k:=length(s2);
m:=length(s3);
delete(s1,1,k);
delete(s1,l-p+2,m);
s1:=s3+s1+s2;
writeln(s1);
end.
Program five_a;
uses crt;
var s1:string;
x:integer;
begin
readln(s1);
for x:=1 to length(s1) do
if copy(s1,x,1)=' ' then
begin
delete(s1,x,1);
insert('_',s1,x);
end;
writeln(s1);
end.
Program five_b;
uses crt;
var s1:string;
s2:char;
x,y:integer;
begin
readln(s1);
y:=0;
for x:=1 to length(s1) do
begin
s2:=s1[x];
if (s2<>' ') and ((ord(s2)<48) or (ord(s2)>57)) then inc(y);
end;
writeln(y);
end.
Program five_c;
uses crt;
var s1:string;
s2:char;
x,y:integer;
begin
readln(s1);
y:=0;
for x:=1 to length(s1) do
begin
s2:=s1[x];
if (ord(s2)<=90) and (ord(s2)>=65) then inc(y);
if (ord(s2)>=192) and (ord(s2)<=223) then inc(y);<br> end;
writeln(y);
end.