Cod sursa(job #723255)
Utilizator | Data | 25 martie 2012 10:42:13 | |
---|---|---|---|
Problema | Ordine | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<cstdio>
#include<cstring>
int ch[27];
int main()
{
freopen("ordine.in","r",stdin);freopen("ordine.out","w",stdout);
int i,aux=-1;char s;
while(scanf("%c",&s)!=EOF)
ch[s-96]++;
for(i=1;i<=26;i++)
if(ch[i])
{
printf("%c",i+96);ch[i]--;
if(aux!=-1)
{
i=aux;aux=-1;continue;
}
if(ch[i])
aux=i-1;
}
}