#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdio>
#define MAX 5000 + 2
using namespace std;
char s[MAX];
int main(){
vector<int> vec;
int t;
char *p;
while(scanf("%s", s) == 1){
p = strtok(s, "5");
if(p == NULL){
printf("0\n");
continue;
}
while(p != NULL){
sscanf(p, "%d", &t);
vec.push_back(t);
p = strtok(NULL, "5");
}
sort(vec.begin(), vec.end());
int flag = 1;
for(int i = 0; i != vec.size(); ++i)
if(flag) printf("%d", vec[i]), flag = 0;
else printf(" %d", vec[i]);
puts("");
vec.clear();
}
return 0;
}
转载于:https://www.cnblogs.com/changmu/p/3639734.html