#include <stdio.h>
#include <string>
#include<algorithm>
#include <iostream>
using namespace std;
char s[1010];
int a[1010];
int main()
{
while ( cin>>s )
{
char *t;
int n = 1;
memset ( a, 0, sizeof ( a ) );
t = strtok ( s,"5" );
a[0] = atoi ( t );
while ( t = strtok ( NULL,"5" ) )
{
a[ n ++ ] = atoi ( t );
}
sort(a,a+n);
for ( int i = 0; i != n; ++ i )
{
printf(i ? " %d" : "%d",a[i]);
}
putchar ( '\n' );
}
return 0;
}