Cod sursa(job #403189)
Utilizator | Data | 24 februarie 2010 18:16:28 | |
---|---|---|---|
Problema | Litere | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 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)-1; i++)
for(j=i+1; j<strlen(s); j++)
if(s[i]>s[j]) ++cnt;
printf("%d\n",cnt);
return 0;
}