#include #include #include #include using namespace std; bool comp(int n, int m) { if (n == 4 && m == 7) return true; if (n == 7 && m == 4) return false; if (n > m) return true; return false; } int main() { long long a, b,aa,bb; cin >> a >> b; aa = a; bb = b; stack sa, sb; while (a > 0 || b > 0) { sa.push(a % 10); a /= 10; sb.push(b % 10); b /= 10; } while (!sa.empty()) { if (sa.top() == sb.top()) { sa.pop(); sb.pop(); } else if (comp(sa.top(), sb.top())) { cout << aa << endl; return 0; } else { cout << bb << endl; return 0; } } return 0; }