atcoder#ABC189D. [ABC189D] Logical Expression
[ABC189D] Logical Expression
Score : points
Problem Statement
Given are strings , each of which is AND
or OR
.
Find the number of tuples of variables , where each element is or , such that the following computation results in being :
- ;
- for , if is
AND
, and if isOR
.
Here, and are logical operators.
Constraints
- is
AND
orOR
.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
2
AND
OR
5
For example, if $(x_0,x_1,x_2)=(\text{True},\text{False},\text{True})$, we have , as follows:
- $y_1=y_0 \land x_1 = \text{True} \land \text{False}=\text{False}$
- $y_2=y_1 \lor x_2 = \text{False} \lor \text{True}=\text{True}$
All of the five tuples resulting in are shown below:
5
OR
OR
OR
OR
OR
63
All tuples except the one filled entirely with result in .