Cod sursa(job #255949)
Utilizator | Flavius Anton f.v.anton | Data | 10 februarie 2009 21:35:03 |
---|---|---|---|
Problema | Restante | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 1.04 kb |
#include <fstream.h>
#include <iostream.h>
#include <string.h>
int main()
{
fstream f("restante.in",ios::in), g("restante.out",ios::out);
long n,i,j;
char x[36002][18],aux,temp[18];
f>>n;
for(i=1;i<=n;i++)
{ f>>x[i];
for(j=0;j<strlen(x[i])-1;j++)
for(int k=j+1;k<strlen(x[i]);k++)
if(x[i][j]>x[i][k])
{
aux=x[i][j];
x[i][j]=x[i][k];
x[i][k]=aux;
}
}
for(i=1;i<n;i++)
for(j=i+1;j<=n;j++)
if(strcmp(x[i],x[j])>0)
{
strcpy(temp,x[i]);
strcpy(x[i],x[j]);
strcpy(x[j],temp);
}
long count=0;
for(i=2;i<=n;i++)
if(strcmp(x[i],x[i-1])!=0)
count++;
g<<count; g.close();
f.close();
return 0;
}