Problem:
Bit Operation II

Given two non-negative decimal integers $a$ and $b$, calculate their AND (logical conjunction), OR (logical disjunction) and XOR (exclusive disjunction) and print them in binary representation of 32 bits.

Input

The input is given in the following format.

$a \; b$

Output

Print results of AND, OR and XOR in a line respectively.

Constraints

$0 \leq a, b \leq 2^{32} - 1$

Sample Input 1

8 10

Sample Output 1

00000000000000000000000000001000
00000000000000000000000000001010
00000000000000000000000000000010

Solution in JAVA (judge verdict: Accepted)

import java.util.*;
import java.io.*;

public class Main {
    static StringBuilder sb;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        sb = new StringBuilder();

        long a = sc.nextLong();
        long b = sc.nextLong();

        sb.append(to32BitBinaryString(a & b)).append("\n");
        sb.append(to32BitBinaryString(a | b)).append("\n");
        sb.append(to32BitBinaryString(a ^ b)).append("\n");

        PrintWriter out = new PrintWriter(System.out);
        out.print(sb);
        out.flush();
        
        sc.close();
    }

    public static String to32BitBinaryString(long l) {
        String s = String.format("%32s", Long.toBinaryString(l)).replace(" ", "0");
        return s.substring(s.length() - 32, s.length());
    }
}