1 #include<iostream>
2 #include<algorithm>
3 #include<string.h>
4 #include<stdlib.h>
5 #include<stdio.h>
6 using namespace std;
7 int main()
8 {
9 char s[1010],str[1010];
10 int a[1001],i;
11 while(scanf("%s",s)!=EOF)
12 {
13 int k=i=0;
14 for(int j=0;j<strlen(s);j++)
15 {
16 while(s[j]!='5')
17 {
18 str[k++]=s[j++];
19 }
20 str[k]='\0';
21 if(k>0)//注意,wa了几次,没有考虑5555512345的情况
22 a[i++]=atoi(str);
23 k=0;
24 }
25 sort(a,a+i);
26 for(j=0;j<i;j++)
27 {
28 if(j==i-1)
29 printf("%d\n",a[j]);
30 else
31 printf("%d ",a[j]);
32 }
33 memset(s,0,sizeof(s));
34 }
35 return 0;
36 }