#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair i_i; typedef pair ll_i; typedef pair d_i; typedef pair ll_ll; typedef pair d_d; struct edge { int u, v; ll w; }; ll MOD = 1000000007; ll _MOD = 1000000009; double EPS = 1e-10; int f(int x, int y) { if (x == 4 && y == 7) return 1; if (x == 7 && y == 4) return -1; if (x == y) return 0; if (x < y) return -1; if (x > y) return 1; } int main() { string A, B; cin >> A >> B; string a = A, b = B; for (; A.length() < 10; A = '0' + A); for (; B.length() < 10; B = '0' + B); for (int i = 0; i < 10; i++) { int x = f(A[i] - '0', B[i] - '0'); if (x == -1) { cout << b << endl; return 0; } if (x == 1) { cout << a << endl; return 0; } } }