#include #include #include #include #include #include #include #include #include #define ALL(obj) (obj).begin(),(obj).end() #define RALL(obj) (obj).rbegin(),(obj).rend() #define P pair #define MOD 1000000007 #define INF 1012345678 #define NINF (-2147483647-1) #define LLINF 9223372036854775807 using ll = long long; using namespace std; int main() { string s, t; cin >> s >> t; if (s.length() > t.length()) { cout << s << endl; } else if (s.length() < t.length()){ cout << t << endl; } else { for (int i = 0; i < s.length(); i++) { if (s[i] != t[i]) { if (s[i] == '4' && t[i] == '7') { cout << s << endl; } else if (s[i] == '7' && t[i] == '4'){ cout << t << endl; } else { cout << ((s[i] > t[i]) ? s : t) << endl; } break; } } } getchar(); getchar(); return 0; }