Cod sursa(job #116255)

Utilizator gabitzish1Gabriel Bitis gabitzish1 Data 18 decembrie 2007 01:27:07
Problema Litere Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.35 kb
#include <stdio.h>
int n, v[30], contor;
char s[10004];

int main()
{
   freopen("litere.in","r",stdin);
   freopen("litere.out","w",stdout);
   int i,j;
   scanf("%d",&n);
   scanf("%s",&s);
   for (i = 0; i < n-1; i++)
   {
      for (j = i + 1; j < n; j++) if (s[i] > s[j]) contor++;
   }
   printf("%d\n",contor);
   return 0;
}