#include #include #include #include using namespace std; typedef long long ll; int main(){ string A, B; cin >> A >> B; if (A == B){ cout << A << endl; return 0; } if (A.length() != B.length()){ if (A.length() > B.length()){ cout << A << endl; return 0; } else{ cout << B << endl; return 0; } } for (int i = 0; i < A.length(); i++){ if (A[i] == B[i]) continue; if (A[i] == '4' && B[i] == '7'){ cout << A << endl; return 0; } else if (A[i] == '7' && B[i] == '4'){ cout << B << endl; return 0; } else{ if (A[i]>B[i]) cout << A << endl; else cout << B << endl; return 0; } } return 0; }