Language: C++

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
typedef string::const_iterator State;
int q;
Def formula(State &i){
	Def out;
	if(*i=='('){
		i++;
		out=formula(i);
	}else if(*i=='T')out=1;
	else if(*i=='F')out=0;
	else if(*i=='-')out=1-formula(++i);
	else if(isalpha(*i))out=(q>>(*i-'a'))&1;
	i++;
	int op=0;
	if(*i=='+')op=1;
	if(*i=='-'){op=2;i++;}
	if(*i=='*')op=3;
	if(op){
		i++;
		Def out1=formula(i);
		if(op==1)out|=out1;
		if(op==2)out=!out||out&&!out1;
		if(op==3)out&=out1;
		
	}
	return out;
}
int main(){
	string s,t;
	while(1){
		getline(cin,s);
		if(s=="#")break;
		rep(i,s.size())if(s[i]=='='){
			t=s.substr(i+1);
			s=s.substr(0,i);
		}
		bool h=true;
		rep(i,1<<11){
			q=i;
			if(formula(s.begin())==formula(t.begin())){
				h=false;
				break;
			}
		}
		if(h)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:89:43: error: cannot bind non-const lvalue reference of type 'State&' {aka 'std::__cxx11::basic_string<char>::const_iterator&'} to an rvalue of type 'State' {aka 'std::__cxx11::basic_string<char>::const_iterator'}
   89 |                         if(formula(s.begin())==formula(t.begin())){
      |                                    ~~~~~~~^~
In file included from /usr/include/c++/14/string:48,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_iterator.h:1074:9: note:   after user-defined conversion: '__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const __gnu_cxx::__normal_iterator<_Iter, _Container>&) [with _Iter = char*; <template-parameter-2-2> = void; _Iterator = const char*; _Container = std::__cxx11::basic_string<char>]'
 1074 |         __normal_iterator(const __normal_iterator<_Iter, _Container>& __i)
      |         ^~~~~~~~~~~~~~~~~
a.cc:53:20: note:   initializing argument 1 of 'Def formula(State&)'
   53 | Def formula(State &i){
      |             ~~~~~~~^
a.cc:89:63: error: cannot bind non-const lvalue reference of type 'State&' {aka 'std::__cxx11::basic_string<char>::const_iterator&'} to an rvalue of type 'State' {aka 'std::__cxx11::basic_string<char>::const_iterator'}
   89 |                         if(formula(s.begin())==formula(t.begin())){
      |                                                        ~~~~~~~^~
/usr/include/c++/14/bits/stl_iterator.h:1074:9: note:   after user-defined conversion: '__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const __gnu_cxx::__normal_iterator<_Iter, _Container>&) [with _Iter = char*; <template-parameter-2-2> = void; _Iterator = const char*; _Container = std::__cxx11::basic_string<char>]'
 1074 |         __normal_iterator(const __normal_iterator<_Iter, _Container>& __i)
      |         ^~~~~~~~~~~~~~~~~
a.cc:53:20: note:   initializing argument 1 of 'Def formula(State&)'
   53 | Def formula(State &i){
      |             ~~~~~~~^