#include using namespace std; #define int long long // <-----!!!!!!!!!!!!!!!!!!! #define rep(i,n) for (int i=0;i<(n);i++) #define rep2(i,a,b) for (int i=(a);i<(b);i++) #define rrep(i,n) for (int i=(n)-1;i>=0;i--) #define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--) #define all(a) (a).begin(),(a).end() typedef long long ll; typedef pair P; typedef vector V; typedef vector> VV; signed main() { std::ios::sync_with_stdio(false); std::cin.tie(0); V correct{20104,20063,19892,20011,19874,20199,19898,20163,19956,19841}; string s; cin >> s; V cnt(10, 0); rep(i, s.size()) { if (i == 1) continue; ++cnt[s[i] - '0']; } int a, b; rep(i, 10) { if (cnt[i] > correct[i]) a = i; if (cnt[i] < correct[i]) b = i; } cout << a << " " << b << endl; }