#include #include #include using namespace std; int main() { string n1,n2; cin >> n1 >> n2; if (n1.size() > n2.size()) { cout << n1 << endl; } else if(n1.size() < n2.size()) { cout << n2 << endl; } else { for (int i = 0; i < n1.size(); i++) { if (n1[i] == '4' && n2[i] == '7') { cout << n1 << endl; break; } else if (n1[i] == '7' && n2[i] == '4') { cout << n2 << endl; break; } else if (n1[i] > n2[i]) { cout << n1 << endl; break; } else if (n1[i] < n2[i]) { cout << n2 << endl; break; } } } }