#include #include #include #include #include #include #include #include #include #include #include #include #include #define repd(i,a,b) for (int i=(a);i<(b);i++) #define rep(i,n) repd(i,0,n) #define var auto #define mod 1000000007 #define inf 2147483647 typedef long long ll; using namespace std; int inputValue(){ int a; cin >> a; return a; } template void output(T a, int precision) { if(precision > 0){ cout << fixed << setprecision(precision) << a << "\n"; } else{ cout << a << "\n"; } } // end of template int main() { // source code string a, b; cin >> a >> b; string ret; if (a.size() != b.size()) { ret = (a.size() > b.size()) ? a : b; } else{ rep(i, a.size()){ if (a[i] == '4' && b[i] == '7'){ ret = a; break; } else if (a[i] == '7' && b[i] == '4') { ret = b; break; } else{ if (a[i] != b[i]) { ret = (a[i] > b[i]) ? a : b; } } } } output(ret, 0); return 0; }