Составить программу,определяющую какая буква слова x(первая или последняя) чаще встречается в слове y.

lyda777 lyda777    1   01.06.2019 10:30    0

Ответы
1064738193747 1064738193747  02.07.2020 15:24
Var x,temp:string;
     first,last:char;
     k1,k2:integer;
begin
   write ('X = ');
   readln (x);
   k1:=0;
   k2:=0;
   first:=x[1];
   last:=x[length(x)];
   temp:=x;
   while (pos(first,temp)>0) do
    begin
      inc(k1);
      delete (temp,pos(first,temp),1);
    end;
   temp:=x;
   while (pos(last,temp)>0) do
    begin
      inc(k2);
      delete (temp,pos(last,temp),1);
    end;
   if (k1>k2) then writeln ('First') else
    if (k2>k1) then writeln ('Last') else
      writeln ('Equal');
end.
ПОКАЗАТЬ ОТВЕТЫ
Другие вопросы по теме Информатика