#include #include int cmp(char lhs, char rhs) { if (lhs == '4' && rhs == '7') return 1; if (lhs == '7' && rhs == '4') return -1; return (lhs == rhs ? 0 : lhs < rhs ? -1 : 1); } void solve() { std::string a, b; std::cin >> a >> b; if (a.length() != b.length()) { std::cout << (a.length() > b.length() ? a : b) << std::endl; return; } int n = a.length(); for (int i = 0; i < n; ++i) { int res = cmp(a[i], b[i]); if (res == 0) continue; std::cout << (res > 0 ? a : b) << std::endl; return; } } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }