Solution Link in Java
The problem is a simple one. If you learn Java Strings, it'll be a piece of cake. I suggest you try the problem yourself before proceeding. As a quick reminder, check out this short java string tutorial from tutorialspoint as a guide to this problem.
Now let's come to our solution. After taking the input, we enter a for loop with range from 0 to n-1 , where n is the length of the input string(both strings have the same length). We extract one character from each string and put them in two character variable a and b.
We now check whether they are the same character or not. If they are the same, we output 0. Otherwise, we print out 1 since a and b are not same characters.
After the loop is finished, we get the desired output binary string.
If you face any problem or have any other suggestion, feel free to post a comment.
Don't forget to share and subscribe.