#include using namespace std; int cnt[] = {20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841}; int main () { string s; cin >> s; for (char c : s) cnt[c-'0']--; int from, to; for (int i = 0; i < 10; i++) if (cnt[i] > 0) to = i; else if (cnt[i] < 0) from = i; cout << from << " " << to << endl; }