Cod sursa(job #116180)

Utilizator alexeiIacob Radu alexei Data 17 decembrie 2007 22:04:17
Problema Ordine Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include<stdio.h>

 int a[28];
int main()
{
 freopen("ordine.in","r",stdin);
 freopen("ordine.out","w",stdout);
 
 char g;
 int w;
 while(scanf("%c ",&g)!=EOF)
{   
 w=int(g)-96;   
 ++a[w];    
} 
 int ultima=-1;
 for(int i=1; i<=27; i++)   
 { if(a[i]!=0&&i!=ultima){
   --a[i];
   ultima=i;
   printf("%c",char(i+96));  
   i=0;
}
}
 printf("\n");
    return 0;
}