Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted by asmisha ( 16 years ago )
var
  ss,S:ansistring;
  A:array[1..100000]of ansistring;
  T:array[1..100000]of longint;
  d,KKK,T4,i,n,j:longint;
Procedure qsort(l,r:longint);
  Var
     i,j:longint;
     x,t:string;
  Begin
     i:=l; j:=r;
     x:=a[(l+r)div 2];
     REPEAT
       While a[i]<x do inc(i);
       While a[j]>x do dec(j);
       If i<=j then
       Begin
          t:=a[i];
          a[i]:=a[j];
          a[j]:=t;
          inc(i);
          dec(j)
       End;
     UNTIL i>j;
       If i<r then qsort(i,r);
       If l<j then qsort(l,j)
     End;
 
begin
  Assign(input,'sort.in'); reset(input);
  Assign(output,'sort.out'); rewrite(output);
  readln(S);
  i:=1;
  KKK:=0;
  n:=0;
  d:=length(s);
  while (i <= d) and (s[i]='.') do
    begin
      inc(KKK);
      inc(i);
    end;
  while i<=d do
    begin
      inc(n);
      ss:='';
      while  (i<=d) and (S[i] in ['a'..'z']) do
        begin
          ss:=ss+s[i];
          inc(i);
        end;
      A[n]:=ss;
      T4:=0;
      while (i<=d) and (S[i]='.') do
        begin
          inc(T4);
          inc(i)
        end;
      T[n]:=T4;
    end;
  if n>1 then Qsort(1,n);
  for i:= 1 to KKK do
    write('.');
  for i:= 1 to n do
    begin
      write(a[i]);
      for j:= 1 to t[i] do
        write('.');
    end;
  writeln;
  close(input);
  close(output)
end.

 

Revise this Paste

Children: 21673
Your Name: Code Language: