Given to strings B and G. String B represents a binary code and string G represents a Gray Code. You need to write a program which converts binary code to gray code and vice versa.
First line of input contains a single integer T which denotes the number of test cases. Then T test cases follows. First line of each test case contains a string B. Second line of each test case contains a string G.
For each test case, in the first line convert the binary code in string B to gray code and print. In the second line convert the gray code in string G to binary code and print.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.