Cod sursa(job #122284)
Utilizator | Data | 11 ianuarie 2008 18:34:27 | |
---|---|---|---|
Problema | Litere | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include<stdio.h>
char a[10001],y;
int n,i,j,k,fr[30],x;
int main(){
freopen("litere.in","r",stdin);
freopen("litere.out","w",stdout);
scanf("%ld",&n);
scanf("%c");
i=0;
while(i<n){
scanf("%c",&y);
a[i]=y;
i++;
x=y-'a';
fr[x]++;
for(j=x+1;j<=26;j++)
k=k+fr[j];
}
printf("%ld",k);
return 0;
}