Boolean expression problem

Given a boolean expression with following symbols.
Symbols
‘T’ —> true
‘F’ —> false
And following operators filled between symbols
Operators
& —> boolean AND
| —> boolean OR
^ —> boolean XOR
Count the number of ways we can parenthesize the expression so that the value of expression evaluates to true.

For Example:
The expression is “T | T & F ^ T”, it evaluates true
in 4 ways ((T|T)&(F^T)), (T|(T&(F^T))), (((T|T)&F)^T)
and (T|((T&F)^T)).
Return No_of_ways Mod 1003.
Input:
First line contains the test cases T. 1<=T<=500
Each test case have two lines
First is length of string N. 1<=N<=100
Second line is string S (boolean expression).
Output:
No of ways Mod 1003.

Example:
Input:
2
7
T|T&F^T
5
T^F|F
Output:
4
2

what’s the source of the problem?

1 Like

This problem is already asked by someone else before and he did not reply about source of this problem too… Please provide source of this problem…

This account looks fake to me… -_-
Here is link of same problem asked earlier… https://discuss.codechef.com/questions/109231/boolean-program

@kauts_kanu right that’s the exact same question asked by two different accounts

//