#include #include #include #include #include #include #include #include using namespace std; int main() { string s, t; cin >> s >> t; int a = static_cast(s.size()), b = static_cast(t.size()); if (a > b)cout << s << endl; else if (a < b)cout << t << endl; else { for (int i = 0; i < a; i++) { if (s[i] == t[i])continue; else { if (s[i] == '4'&&t[i] == '7') { cout << s << endl; } else if (s[i] == '7'&&t[i] == '4') { cout << t << endl; } else { if (s[i]>t[i])cout << s << endl; else cout << t << endl; } break; } } } return 0; }