#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long #define INF (1 << 30) #define INFLL (1LL << 60) int main() { string a,b; cin >> a >> b; if(a.size() == b.size()){ for(int i = 0;i < a.size();i++){ if(a[i] == b[i]){ continue; }else{ if(a[i] == '4' && b[i] == '7'){ cout << a << endl; }else if(a[i] == '7' && b[i] == '4'){ cout << b << endl; }else if(a[i] > b[i]){ cout << a << endl; }else{ cout << b << endl; } break; } } }else if(a.size() > b.size()){ cout << a << endl; }else if(a.size() < b.size()){ cout << b << endl; } return 0; }