Cod sursa(job #129293)

Utilizator loriKis Levente Lorand lori Data 28 ianuarie 2008 21:35:05
Problema Restante Scor 50
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.73 kb
var n,i,j:longint;
    aux:char;
    v:array [1..36000] of string[20];
    gasit:boolean;
begin
 assign(input,'restante.in'); reset(input);
 assign(output,'restante.out'); rewrite(output);
  readln(n);
  for i:=1 to n do begin
   readln(v[i]);
   repeat
    gasit:=false;
    for j:=1 to length(v[i])-1 do
     if v[i][j]>v[i][j+1] then begin
      aux:=v[i][j]; v[i][j]:=v[i][j+1]; v[i][j+1]:=aux; gasit:=true;
     end;
   until not gasit;
  end;
  for i:=1 to n do begin
   gasit:=false;
   for j:=i+1 to n do
    if v[i]=v[j] then begin
     v[j]:='!'; gasit:=true;
    end;
   if gasit then v[i]:='!';
  end; j:=0;
  for i:=1 to n do
   if v[i]<>'!' then inc(j);
  writeln(j);
 close(input); close(output);
end.