Вот текст задачи:
Дана строка символов. Определить количество слов, начиная с буквы "а", вывести на печать самое длинное слово, начинающееся с буквы "а"
помогите пожалуйста
Program Lab;
uses crt;
var s:array[1..200] of char;
i,q:integer;
BEGIN
clrscr;
readln(s);
q:=0;
For i:=1 to s do
IF s[i]=#32 AND s[i+1]=#97 THEN
q:=q+1;
writeln(q);
readkey;
end.
Program Lab;
uses crt;
var s:string;
i,q:integer;
BEGIN
clrscr;
readln(s);
q:=0;
For i:=1 to length(s) do
IF s[i]=#32 AND s[i+1]=#97 THEN
q:=q+1;
writeln(q);
readkey;
end.
clrscr;
readln(s);
w:=' ';
Insert(w,s,1);
q:=0;
For i:=1 to length(s) do
IF s[i]=#32 THEN
For i:=1 to length(s) do
IF s[i+1]=#97 then
q:=q+1;
writeln(q);
readkey;
end.
uses crt;
const
letters = [' ', '.', ',']; { символы, которые могут разделять слова }
var
s, s_max: String;
i, start, count: Byte;
begin
clrscr;
write('s = '); readln(s);
count := 0;
s_max := '';
i := 1;
while i <= length(s) do begin
while (i <= length(s)) and (s[i] in letters) do
inc(i);
if i <= length(s) then begin
start := i;
if s[i] = 'a' then
inc(count);
while (i <= length(s)) and not (s[i] in letters) do
inc(i);
if (s[start] = 'a') and (i - start > Length(s_max)) then
s_max := Copy(s, start, i - start);
end;
end;
writeln('count = ', count);
writeln('s_max = "', s_max, '"');
readln;
end.