Cod sursa(job #292872)

Utilizator GheorgheMihaiMihai Gheorghe GheorgheMihai Data 31 martie 2009 19:13:20
Problema Litere Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.36 kb
#include<stdio.h>
int ap[30];
char s[10002];

void read()
{
	freopen("litere.in","r",stdin);
	freopen("litere.out","w",stdout);
	int i=0,j;
	long su=0;
	scanf("%d\n",&i);
	gets(s);
	i=0;
	while(s[i])
	{
		for(j=s[i]-'a'+2;j<=26;j++)
			su=su+ap[j];
		ap[s[i]-'a'+1]++;
		i++;
	}
	printf("%ld\n",su);
}
int main()
{
	read();
	return 0;
}