BETA

Difficulty Level: Basic

Submissions: 26 Accuracy:

42.31%

Gray to Binary and Binary to Gray
     

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.

Input:
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.

Output:
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.

Constraints:
1<=T<=100
1<=length(B)<=105
1<=length(G)<=105

Example:
Input:
2
0011
01101
01001
01101
Output:
0010
01001
01101
01001

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Harsh Agarwal

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.