#include using namespace std; using ll = long long; using ull = unsigned long long; #define rep(i,m,n) for(int i=m; i bool chmin(T& a, T b){ if(a > b){a = b; return true;} return false; } template bool chmax(T& a, T b){ if(a < b){a = b; return true;} return false; } template T gcd(T a, T b){ return a % b ? gcd(b, a % b) : b; } template T lcm(T a, T b){ return a / gcd(a, b) * b; } char comp(char c, char d){ if((c == '4' && d == '7') || (c == '7' && d == '4')){ return c == '4' ? c : d; }else{ return max(c, d); } } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); string a, b; cin >> a >> b; if(leng(a) != leng(b)){ cout << (leng(a) > leng(b) ? a : b) << endl; }else{ rep(i, 0, leng(a)){ if(a[i] == b[i]) continue; cout << (comp(a[i], b[i]) == a[i] ? a : b) << endl; break; } } return 0; }