Bit operations

Background:

Good ol' bit operations. In this problem, you'll be applying bit operations to two bit strings.

Input:

Each test case will be three lines. The first line will be a bit string (1s and 0s), the second line will be one character representing what bit operation should be carried out, and the third string will be the second bit string. The operations we're concerned about are exclusive or, bitwise or, and bitwise and. The character will representing those operations will be an X for exclusive or, O for bitwise or, and A for bitwise and. No other characters will appear there. The strings will be no more than 80 characters long.

Just to refresh your memory, here are the truth tables for those operations:

Bitwise or (O): Bitwise and (A): Exclusive or (X):
P Q P O Q
0 0 0
0 1 1
1 0 1
1 1 1
P Q P A Q
0 0 0
0 1 0
1 0 0
1 1 1
P Q P X Q
0 0 0
0 1 1
1 0 1
1 1 0

Output:

Your program is to print out the resultant string after applying the operation to the given input strings. Leading 0s should not be printed. If your answer string is all 0s, then print exactly one 0. The operations are carried out bit by bit. If the two input strings are not equal length, you may pad the shorter string with 0s in the leftmost position.

Sample Input:

1010001100
X
100
1
O
101010101011010101010
101101111001111011111111100
A
000000

Sample Output:

10100010001
1010101010110101010110
0