Pagini recente » Cod sursa (job #219829) | Cod sursa (job #3163965) | Cod sursa (job #1094283) | Cod sursa (job #2231305) | Cod sursa (job #431582)
Cod sursa(job #431582)
#include<stdio.h>
FILE *f=fopen("litere.in","r"), *g=fopen("litere.out","w");
int i,j,n, ver[10010];
long s;
char v[10010],m;
int main()
{
fscanf(f,"%d%c", &n, &m);
for(int i=1;i<=n;i++)
fscanf(f,"%c", &v[i]);
for(int i=1;i<=n;i++)
{
ver[v[i]-'a']++;
for(j=v[i]-'a'+1; j<='z'-'a'; j++)
s+=ver[j];
}
fprintf(g,"%ld",s);
return 0;
}