Augustus is doing his binary math homework. He is not sure that his answers are correct, so he wants to check his answers with you.
Recall that the primary binary operators are the
or
(|
), and
(&
), and xor
(^
) operators.
Operator Details
The or
operator will output if either inputs are
, and
otherwise.
1 | 1 = 1
0 | 1 = 1
1 | 0 = 1
0 | 0 = 0
The and
operator will output if both inputs are
, and
otherwise.
1 & 1 = 1
0 & 1 = 0
1 & 0 = 0
0 & 0 = 0
The xor
operator will output if exactly one of the inputs is
, and
otherwise.
1 ^ 1 = 0
0 ^ 1 = 1
1 ^ 0 = 1
0 ^ 0 = 0
Help Augustus check his answers by simulating these operators on some numbers!
Input Specification
The first line will contain the integer
, the length of each number in binary.
The second line will contain the first number in binary, , the operator to simulate,
, and the second number in binary,
, separated by spaces.
- If
is
|
, you must simulate theor
operator. - If
is
&
, you must simulate theand
operator. - If
is
^
, you must simulate thexor
operator.
It is guaranteed both and
will be of length
.
Output Specification
Output the resultant number in binary after the performing the specified operation on
and
.
Sample Input 1
5
10111 & 11100
Sample Output 1
10100
Sample Input 2
6
101111 ^ 110011
Sample Output 2
011100
Comments