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