We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- XOR Strings 2
- Discussions
XOR Strings 2
XOR Strings 2
Sort by
recency
|
240 Discussions
|
Please Login in order to post a comment
There is no 'strings_xor' function in the 'Javascript (Node.js)' mode. Is this a bug? What should I debug in corresponing to the test conditions?
For Python:
For C++, it looks like the submission process is broken for modes C++14/C++20.
Those modes gave wrong answer for code that was successully submitted in C++11 mode!
This function performs a bitwise XOR operation on two input strings
s
andt
.The XOR operation compares corresponding characters of the two strings:
- If the characters are the same, it appends '0' to the result string.
- If the characters are different, it appends '1' to the result string.
def strings_xor(s, t): res = "" # Initialize an empty result string
Input: Two binary strings from the user
s = input() # First binary string t = input() # Second binary string
Output: The XOR of the two input strings
print(strings_xor(s, t))