#include using namespace std; signed main(){ string A, B; cin >> A >> B; if( A.size() != B.size() ) cout << ( A.size() > B.size() ? A : B ) << endl, exit( 0 ); for( int i = 0; i < A.size(); ++i ) if( A[ i ] != B[ i ] ){ if( A[ i ] == '4' and B[ i ] == '7' ) cout << A << endl; else cout << ( A[ i ] > B[ i ] ? A : B ) << endl; break; } return 0; }