#include using namespace std; int main() { string S; cin >> S; int cnt[10] = {20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841}; for (auto c : S) { int i = c - '0'; if (i >= 0 and i < 10) cnt[i]--; } string ret = "0 0\n"; for (int i = 0; i < 10; i++) { if (cnt[i] < 0) ret[0] += i; if (cnt[i] > 0) ret[2] += i; } cout << ret; }