#include <iostream>
using namespace std;
#define REP(i,x) for(int i=0;i<(int)(x);i++)
unsigned char c, x[11] = "dcdcbcbcda";
main(){
	while(cin >> c)if(isdigit(c)) x[c - '0']--;
	REP(i, 10) if(x[i]%4 == 3) cout << i << ' ';
	REP(i, 10) if(x[i]%4 == 1) cout << i << endl;
	return 0;
}