XOR Strings 2

  • + 0 comments

    This below code will work for c++11 .

    using namespace std;

    string strings_xor(string s, string t) {

    string res = "";
    for(int i = 0; i < s.size(); i++) {
        if(s[i] == t[i])
            res = res+'0';
        else
            res = res+'1';
    }
    
    return res;
    

    }

    int main() { string s, t; cin >> s >> t; cout << strings_xor(s, t) << endl; return 0; }