Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- mas: string;
- c, tmp: char;
- i, j, count, max: integer;
- begin
- count := 0;
- max := 0;
- write('Введите строку: ');
- readln(mas);
- tmp := chr(255);
- for i := 1 to length(mas) do
- begin
- c := mas[i];
- for j := 1 to length(mas) do
- begin
- if mas[j] = c then
- inc(count);
- end;
- if max <= count then
- begin
- if (max = count) and (tmp > c)then
- begin
- max := count;
- tmp := c
- end;
- if max < count then
- begin
- max := count;
- tmp := c
- end
- end;
- count := 0;
- end;
- write('Самый популярный символ: ', tmp, ', встречается раз: ', max)
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement