Please tell me why is it wrong?

#include <iostream>
#include <string>

int main() {
    int t = 0;
    std::string str1;
    std::string str2;
    std::string str3;
    std::cin >> t;
    while (t--) {
        std::cin >> str1;
        std::cin >> str2;
        for (size_t i = 0; i <= str1.std::string::length(); ++i) {
            if ((str1[i] == '0' && str2[i] == '1') ||
                (str1[i] == '1' && str2[i] == '0'))
                str3[i] = '1';
            else if (i == str1.std::string::length())
                ;
            else
                str3[i] = '0';
        }
        for (size_t i = 0; i < str1.std::string::length(); ++i)
            std::cout << str3[i];
    }
    return 0;
}

Hello @moon your code is perfectly fine .
you have to just print the output for every test case in the new line.


if you have any doubt you can ask here:
Happy Learning!!

1 Like

Thanks for the help! :grinning:

@moon you can mark this doubt as resolved.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.