Cod sursa(job #199776)
| Utilizator | Data | 20 iulie 2008 15:16:53 | |
|---|---|---|---|
| Problema | Ordine | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.46 kb |
# include <stdio.h>
# include <string.h>
int i,ok,fr[300],x;
char a[1000000],c;
int main ()
{
freopen ("ordine.in","r",stdin);
freopen ("ordine.out","w",stdout);
scanf ("%s",&a);
for (i=0;i<strlen (a);i++)
{
x=a[i];
fr[x-97]++;
}
while (ok==0)
{
ok=1;
i=0;
while (i<26)
{
if (fr[i]!=0)
{
ok=0;
fr[i]--;
c=i+97;
printf ("%c",c);
}
i++;
}
while (i<26)
{
if (a[i]!=0)
{
c=i+97;
printf ("%c",c);
fr[i]--;
break;
}
i++;
}
}
return 0;
}