#define _USE_MATH_DEFINES #include //cin, cout #include //vector #include //sort,min,max,count #include //string,getline, to_string #include //abs(int) #include //swap, pair #include //deque #include //INT_MAX #include //bitset #include //sqrt, ceil. M_PI, pow, sin #include //fixed #include //setprecision #include //stringstream #include //gcd, assumlate #include //randam_device #include //numeric_limits using namespace std; constexpr long long int D_MOD = 1000000007; inline unsigned int BinToUInt(const string S) { //2進数(文字列)を10進数(unsigned int)に変換する unsigned int result = 0; for (unsigned int i = 0; i < S.length(); i++) { switch (S[i]) { case '0':result *= 2; break; case '1':result = result * 2 + 1; break; } } return result; } int main() { string A, B; cin >> A >> B; int ans; if (A.size() > B.size()) { for (int i = 1; i <= B.size(); i++) { if (A.at(A.size() - i) == B.at(B.size() - i)) { A.at(A.size() - i) = '0'; } else { A.at(A.size() - i) = '1'; } } ans = BinToUInt(A); } else { for (int i = 1; i <= A.size(); i++) { if (A.at(A.size() - i) == B.at(B.size() - i)) { B.at(B.size() - i) = '0'; } else { B.at(B.size() - i) = '1'; } } ans = BinToUInt(B); } cout << ans << endl; return 0; }