#include #include int main() { std::string a, b; std::cin >> a >> b; std::string c = a, d = b; for (int i = 0; i < a.length(); i++) { if (a[i] == '4' && b[i] == '7') { c[i] = '7'; d[i] = '4'; } else if (a[i] == '7'&& b[i] == '4') { c[i] = '4'; d[i] = '7'; } } long long e = std::stoi(c); long long f = std::stoi(d); if (e > f) { std::cout << a << std::endl; return 0; } else { std::cout << b << std::endl; return 0; } }