# include # include # include # include # include # include # include # include # include # include # include # include # include using namespace std; using LL = long long; constexpr long long MOD = 1000000000 + 7; constexpr long long INF = 1000000000; const double PI = acos(-1); int main() { int a[10] = { 20104,20063,19892,20011,19874,20199,19898,20163,19956,19841 }; string s; cin >> s; int ans; for (int i = 0; i < s.size(); i++) { if (i != -1)a[i - '0']--; } for (int i = 0; i < 10; i++) { if (a[i] == -1) { cout << i << " " << i - 1 << endl; break; } else if (a[i] == 1) { cout << i << " " << i + 1 << endl; break; } } }