var
s : string;
i : integer;
f : boolean;
begin
readln (s);
writeln ('Тут ', length (s), ' символов');
f := true;
for i := 1 to length (s) div 2 do
if s[i] <> s[length (s) - i + 1] then f := false;
writeln ('Это слово является перевертышем: ', f); //True/False
end.
var
s : string;
i, k, count : integer;
c : char;
begin
readln (s);
count := 0;
for i := 1 to length (s) do
if s[i] <> ' ' then
begin
c := s[i];
k := i + 1;
break;
end;
for i := k to length (s) do
if (s[i] = ' ') and (c <> ' ') then
begin
if s[i - 1] = c then inc (count);
c := ' ';
end
else if c = ' ' then c := s[i];
if (c <> ' ' ) and (s[length (s)] <> ' ') and (c = s[length (s)]) then inc (count);
writeln (count);
end.
var a,b:array[1..n] of integer;
i,j,c:integer;
begin
writeln('Исходный массив:');
for i:=1 to n do
begin
a[i]:=random(51)-25;
write(a[i]:4);
end;
writeln;
j:=0;
for i:=1 to n do
begin
c:=abs(a[i]) mod 10;
if (c=3)or(c=7)or(c=9) then begin j:=j+1; b[j]:=a[i]; end;
end;
writeln('Полученный массив:');
for i:=1 to j do write(b[i]:4);
writeln;
end.
Пример:
Исходный массив:
17 6 15 -23 19 -5 -12 -14 5 20
Полученный массив:
17 -23 19