Write this once at the beginning of main:

Set tset;
tset.insert('t');
Set fset;
fset.insert('f');
std::string pf;
bool answer;
// Generated at
// TomBinford.github.io/expressions

Generate test cases:


Output: