#include #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, n) for (ll i = 1; i <= (n); ++i) #define rrep(i, n) for (ll i = (n - 1); i >= 0; --i) #define perm(c) sort(ALL(c));for(bool c##p=1;c##p;c##p=next_permutation(ALL(c))) #define ALL(obj) (obj).begin(), (obj).end() #define pb push_back #define to_s to_string #define len(v) (ll)v.size() #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) #define print(x) cout << (x) << '\n' #define debug(x) cout << #x << ": " << (x) << '\n' using namespace std; using ll = long long; typedef pair P; typedef vector vec; typedef vector> vec2; typedef vector>> vec3; ll MOD = 1e9 + 7; ll devc(ll x, ll y) { return 1 + (x - 1) / y; } templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> T) S += T + "X"; S.pop_back(); ll N = len(S); rep(i,N) rep(j,N) if(i < j){ map state; state['X'] = 1; for (ll k = 0; k < i; ++k) state[S[k]] = 1; for (ll k = j + 1; k < N; ++k) state[S[k]] = 1; for (ll k = i; k <= j; ++k) if((k - i) % 2 == 1) state[S[k]] = 1; bool flag = true; for (ll k = i; k <= j; ++k) if((k - i) % 2 == 0) if(state[S[k]] == 1) flag = false; if(flag){ print("Yes"); return 0; } } print("NO"); return 0; }