Вводится текст из файла INPUT.TXT.Записать в файл с именем OUTPUT.TXT слова, в записи которых нет одинаковых букв — Pascal(Паскаль)

var
  f1,f2:text;
  c:char;
  temp:string;
{ôóíêöèÿ ïðîâåðêè}
function Proverka(s:string):boolean;
var
  i,j,count:integer;
  fl:boolean;
begin
  fl:=true;
  count:=0;
  i:=1;
  while (fl) and (i<=length(s)-1) do
  begin
    for j:=i+1 to length(s) do
      if (s[j]=s[i]) and ((s[j]<>' ') or (s[i]<>' ')) then
        inc(count);
    if count<>0 then
      fl:=false;
    inc(i)
  end;
  Result:=fl
end;
{îñíîâíàÿ ïðîãðàììà}
begin
  assign(f1,'input.txt');
  assign(f2,'output.txt');
  reset(f1);
  rewrite(f2);
  while not EOF(f1) do
  begin
    temp:='';
    while not EOLn(f1) do
    begin
      read(f1,c);
      if c<>' ' then
      temp:=temp+c;
      if (c=' ') or (EOLn(f1)) then
      begin
        if Proverka(temp) then
          write(f2,temp,' ');
        temp:=''
      end;
    end;
    writeln(f2);
    readln(f1)
  end;
  close(f1);
  close(f2)
end.

Leave a Comment

85 − 78 =