#include #include #include using namespace std; #define RREP(i,s,e) for (i = e-1; i >= s; i--) #define rrep(i,n) RREP(i,0,n) #define REP(i,s,e) for (i = s; i < e; i++) #define rep(i,n) REP(i,0,n) #define INF 1e8 typedef long long ll; int main() { int i; string a, b, ta, tb; cin >> a >> b; if (a.size() < b.size()) cout << b << endl; else if (a.size() > b.size()) cout << a << endl; else { string ans; for (int i = 0; i < a.size(); i++) { if (a[i] == '4' && b[i] == '7') { ans = a; break; } else if (a[i] == '7' && b[i] == '4') { ans = b; break; } else if (a[i] < b[i]) { ans = b; break; } else if (a[i] > b[i]) { ans = a; break; } } cout << ans << endl; } return 0; }