#include using namespace std; int main(void) { int counts[] = {20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841}; vector ans(2); string s; cin >> s; for (int i = 0; i < 10; i++) { int cnt = count(s.begin(), s.end(), '0' + i); if (cnt < counts[i]) ans[0] = i; if (cnt > counts[i]) ans[1] = i; } cout << ans[0] << " " << ans[1]; return 0; }