Bitwise Operations on Binary Numbers

Given two equal-length binary strings, output their bitwise AND, OR, XOR, and the complemented forms of each, keeping length and leading zeros.

Easy2StringBit manipulationImplementationNo attempts yetTime limit2sMemory limit512 MB

Problem

You are given two binary numbers A and B of the same length. Compute the five bitwise results A & B, A | B, A ^ B, ~A, and ~B.

Every operation is applied position by position. A bit of & is 1 only when both bits at that position are 1. A bit of | is 1 when at least one of them is 1. A bit of ^ is 1 when the two bits differ. ~ turns each 0 into 1 and each 1 into 0.

Each result is a binary number of the same length as the input, and its leading zeros stay in place.

Input

The first line has the binary number A and the second line has the binary number B. The two numbers have the same length LL, where 1L1000001 \le L \le 100000.

Output

Print five lines. Print A & B on the first line, A | B on the second, A ^ B on the third, ~A on the fourth, and ~B on the fifth. Each line is a binary number of length LL, with leading zeros kept.