Cod sursa(job #403187)
| Utilizator | Data | 24 februarie 2010 18:14:38 | |
|---|---|---|---|
| Problema | Litere | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.39 kb |
#include<stdio.h>
#include<string.h>
#define N 10000
void inter(char &c1, char &c2)
{
char aux;
aux=c1;
c1=c2;
c2=aux;
}
int main()
{
freopen("litere.in","r",stdin);
freopen("litere.out","w",stdout);
char s[N];
int i,j,cnt=0;
gets(s); gets(s);
for(i=0; i<strlen(s); i++)
for(j=0; j<=i; j++)
if(s[j]>s[i]) ++cnt;
printf("%d\n",cnt);
return 0;
}
