#include #include #include #include using namespace std; int main() { string S; cin >> S; vector tmp1(10), tmp2{ 20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841 }; ++tmp1[3]; for (int i = 2; i < 200002; ++i) ++tmp1[S[i] - '0']; pair ans; for (int i = 0; i < 10; ++i) { if (tmp1[i] == tmp2[i] + 1) ans.first = i; else if (tmp1[i] == tmp2[i] - 1) ans.second = i; } cout << ans.first << ' ' << ans.second; }