Дан текст, состоящий из строчных латинских букв. Вывести те, которые встречаются в тексте не менее 2-х раз — Pascal(Паскаль)

Program mn_9;

uses crt;

type
  let = 'a' .. 'z';

var
  mn1, mn2: set of let;
  s: string;
  c: char;
  i: integer;

begin
  clrscr;
  writeln('введите текст, заканчивающийся точкой');
  readln(s);
  if s[length(s)] <> '.' then
    s := s + '.';
  i := 1;
  mn1 := [];
  mn2 := [];
  while s[i] <> '.' do
  begin
    If s[i] in mn1 then
      mn2 := mn2 + [s[i]];
    mn1 := mn1 + [s[i]];
    i := i + 1;
  end;
  for c := 'a' to 'z' do
    if c in mn2 then
      write(c:2);
  readln;

end.

Leave a Comment

− 5 = 4