#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define MAX_N 2000100 #define LOG 21 #define PI 3.141592653589 #define EPS 1e-10 #define MOD 1000000007 #define YJSNPI 810 #define INF (1 << 30) #define ADD(a, b) a = (a + (ll)b) % MOD #define MUL(a, b) a = (a * (ll)b) % MOD #define MAX(a, b) a = max(a, b) #define MIN(a, b) a = min(a, b) #define REP(i, a, b) for(int i = a; i < b; i++) #define RER(i, a, b) for(int i = a - 1; i >= b; i--) using namespace std; typedef long long ll; typedef pair pi; typedef pair ppi; typedef vector> mat; string solve(const string& s1, const string& s2) { if(s1.size() > s2.size()) return s1; if(s1.size() < s2.size()) return s2; int N = s1.size(); REP(i, 0, N) { int a = s1[i] - '0', b = s2[i] - '0'; if(a == 4 && b == 7) return s1; else if(a == 7 && b == 4) return s2; else if(a > b) return s1; else if(a < b) return s2; } } int main() { string str1, str2; cin >> str1 >> str2; cout << solve(str1, str2) << endl; }