View difference between Paste ID: zG4aXkr4 and UGYwS8Ye
SHOW: | | - or go back to the newest paste.
1-
const
1+
2-
  N = 256;
2+
3
  c, tmp:              char;
4
  i, j, count, max: integer;
5
6
begin
7
  count := 0;
8
  max   := 0;
9
  write('Введите строку: ');
10
  readln(mas);
11
  tmp := chr(255);
12
  
13
  for i := 1 to length(mas) do
14
  begin
15
    c := mas[i];
16
    
17
    for j := 1 to length(mas) do
18
    begin
19
      if mas[j] = c then
20
        inc(count);
21
    end;
22
    
23
    if max <= count then
24
    begin
25
       if (max = count) and (tmp > c)then
26
       begin
27
           max := count;
28
           tmp := c
29
       end;
30
       if max < count then
31
       begin
32
         max := count;
33
         tmp := c
34
       end
35
    end;
36
    
37
    count := 0;
38
  end;
39
  
40
  write('Самый популярный символ: ', tmp, ', встречается раз: ', max)
41
end.