{ 2 datnes. Skaitli ievaditi augosa seciba.
Atdaliti ar komatiem.
Izveidot 3 datne, kur skaitli ir augosa seciba}

uses crt;
var f1,f2,f3: text;
    x,y: char;
    s1,s2,s3: string;
    i: integer;

begin
clrscr;
writeln('Imya pervogo fajla'); readln(s1);
writeln('Imya vtorogo fajla'); readln(s2);
assign(f1,s1); assign(f2,s2);
writeln('Imya novogo fajla'); readln(s3);
assign(f3,s3);
reset(f1); reset(f2); rewrite(f3);
while not eof(f1)
      do begin
      while not eoln(f1)
            do begin
               while not chr(44) do begin
               read(f1,x); read(f2,y);
               if x<y then write(f3,x) else write(f3,y);
               end;
            end;
      readln(f1); writeln;
      writeln(f2);
      end;
close(f1); close(f2);
readkey
end.