#include "bits/stdc++.h" using namespace std; //諸機能 #pragma region MACRO #define putans(x) cerr << "answer: "; cout << (x) << endl #define dputans(x) cerr << "answer: "; cout << setprecision(10) << (x) << endl #define REP(i, a, n) for (int i = ( a ); i<(int)( n ); i++) #define RREP(i, a, n) for (int i = (int)( n ); i >= a; i--) #define rep(i, n) REP(i, 0, n) #define rrep(i, n) RREP(i, 0, n) #define ALLOF(a) begin((a)),end((a)) #define FILL(a,n) for(auto &hoge : (a)) hoge = (n) #define mp(a,b) (make_pair(a,b)) #define exist(container, n) ((container).find((n)) != (container).end()) #define SUBSTR(s,i,l) string((s), (i), (l)) #define NPI_TO_RAD(x) (180.0*x/PI) #define RAD_TO_NPI(x) (PI/180.0*x) #pragma endregion //デバッグなどの支援 #pragma region CODING_SUPPORT #define dg(var0) { std::cerr << (#var0) << "=" << (var0) << endl; } #define dgg(var0, var1) { std::cerr << (#var0) << "=" << (var0) << ", ";dg(var1); } #define dggg(var0, var1, var2) { std::cerr << (#var0) << "=" << (var0) << ", ";dgg(var1,var2); } #define dgggg(var0, var1, var2, var3) { std::cerr << (#var0) << "=" << (var0) << ", ";dggg(var1,var2,var3); } #pragma endregion //typedef(書き換える、書き足す可能性ある) #pragma region TYPE_DEF typedef long long ll; typedef pair pii; typedef pair pss; typedef pairpis; typedef pairpsi; typedef vector vs; typedef vector vi; #pragma endregion //諸々の定数(書き換える可能性ある) #pragma region CONST_VAL #define PI (2*acos(0.0)) #define EPS (1e-9) #define MOD (1e9 + 7) #pragma endregion int main() { string a, b; cin >> a >> b; if (a.length() > b.length()) { putans(a); return 0; } if (b.length() > a.length()) { putans(b); return 0; } rep(i, a.length()) { int x = a[i] - '0'; int y = b[i] - '0'; if (x != y) { if (x == 4 && y == 7) { putans(a); break; } if (x == 7 && y == 4) { putans(b); break; } if (x > y) { putans(a); break; } else { putans(b); break; } } } return 0; }