Cod sursa(job #657737)
Utilizator | Data | 7 ianuarie 2012 12:19:33 | |
---|---|---|---|
Problema | Litere | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
# include <cstdio>
using namespace std;
char s;
int cif, i, j, n, ct, ap[28];
int main()
{
freopen("litere.in","r",stdin);
freopen("litere.out","w",stdout);
scanf("%d\n",&n);
for (i = 1; i <= n; i++)
{
scanf("%c",&s);
cif = s - 'a';
ap[cif]++;
for (j = cif + 1; j <= 25; j++)
ct += ap[j];
}
printf("%d",ct);
return 0;
}