import
java.util.*;
class
GFG{
static
int
[]digit =
new
int
[
100000
];
static
int
findDigits(
int
n)
{
int
count =
0
;
while
(n !=
0
) {
digit[count] = n %
10
;
n = n /
10
;
++count;
}
return
count;
}
static
int
OR_of_Digits(
int
n,
int
count)
{
int
ans =
0
;
for
(
int
i =
0
; i < count; i++) {
ans = ans | digit[i];
}
return
ans;
}
static
int
AND_of_Digits(
int
n,
int
count)
{
int
ans =
0
;
for
(
int
i =
0
; i < count; i++) {
ans = ans & digit[i];
}
return
ans;
}
static
int
XOR_of_Digits(
int
n,
int
count)
{
int
ans =
0
;
for
(
int
i =
0
; i < count; i++) {
ans = ans ^ digit[i];
}
return
ans;
}
static
void
bitwise_operation(
int
N)
{
int
countOfDigit = findDigits(N);
System.out.print(
"XOR = "
+ XOR_of_Digits(N, countOfDigit)
+
"\n"
);
System.out.print(
"OR = "
+ OR_of_Digits(N, countOfDigit)
+
"\n"
);
System.out.print(
"AND = "
+ AND_of_Digits(N, countOfDigit)
+
"\n"
);
}
public
static
void
main(String[] args)
{
int
N =
123456
;
bitwise_operation(N);
}
}