#include #include #include #include #include #include #include #include #include int main() { std::string A, B; std::cin >> A >> B; // step 1 if( A.size() != B.size() ) { if( A.size() < B.size() ) { std::cout << B << std::endl; } if( A.size() > B.size() ) { std::cout << A << std::endl; } return 0; } // step 2 assert( A.size() == B.size() ); for(int i = 0; i < (int)A.size(); ++i) { if( A[i] != B[i] ) { if( A[i] == '4' and B[i] == '7' ) { std::cout << A << std::endl; } else if( A[i] == '7' and B[i] == '4' ) { std::cout << B << std::endl; } else { if( A[i] < B[i] ) { std::cout << B << std::endl; } else if( A[i] > B[i] ) { std::cout << A << std::endl; } } return 0; } } return 0; }