Cod sursa(job #111468)

Utilizator Allosaurusqwertyldskfn Allosaurus Data 29 noiembrie 2007 21:54:24
Problema Ordine Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.59 kb
Var f,g:Text;
    x:Char;
    p:String;
    ok:Boolean;
    i:Longint;

Begin

Assign(f,'ordine.in'); ReSet(f);
Assign(g,'ordine.out'); ReWrite(g);

p:='';

While Not EOF(f) Do Begin
      While Not EOLN(f) Do Begin
            Read(f,x);
            i:=1;
            ok:=False;
            Repeat
            if (x<p[i])and(x<>p[i-1])and(x<>p[i+1]) Then Begin
               Insert(x,p,i);
               ok:=True;
               End;
            Inc(i);
            Until ok;
            End;
      ReadLn(f);
      End;

WriteLn(g,p);

Close(f);
Close(g);

End.