Cod sursa(job #129656)

Utilizator loriKis Levente Lorand lori Data 29 ianuarie 2008 20:50:07
Problema Restante Scor 50
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.91 kb
var n,i,j:longint;
    aux,c:char;
    v,a:array [1..36000] of string[20];
    gasit:boolean;
    v2,a2:array ['a'..'z'] of longint;
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
}  for j:=1 to length(v[i]) do inc(v2[v[i][j]]);
   v[i]:=a[i];
   for c:='a' to 'z' do
    for j:=1 to v2[c] do v[i]:=v[i]+c;
   v2:=a2;
  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.