|All-time Popular Problems|
|Inorder Successor in BST|
|Maximum Product Subarray|
|Is Binary Number Multiple of 3|
|Pairwise swap elements of a linked list by swapping data|
|Largest Number formed from an Array|
|Reverse an Array|
|Boundary Traversal of binary tree|
|Leaders in an array|
Given a string consisting of only 0, 1, A, B, C where
A = AND
B = OR
C = XOR
Calculate the value of the string assuming no order of precedence and evaluation is done from left to right.
The first line of input contains an integer T denoting the number of test cases.
The next T lines contains T strings.
Print the value of the string assuming no order of precedence and evaluation is done from left to right
1 ≤ T ≤ 100
1 ≤ length(string)<=1000
Output : 1
1 AND 0 OR 1 = 1