#include #include #include #include using namespace std; int main(){ int number_count[10] = {20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841}; string input_pi; cin >> input_pi; number_count[input_pi[0] - '0']--; for(int i = 2; i < 2e5 + 2; i++){ number_count[input_pi[i] - '0']--; } int before = -1, after = -1; for(int i = 0; i < 10; i++){ if(number_count[i] == -1){ before = i; }else if(number_count[i]){ after = i; } } cout << before << " " << after << endl; }