What is wrong with my STROPERS brute force solution?

All example test cases pass, but still getting error. Please help

#include
#include
#include <unordered_set>
#include
#include <unordered_map>
#include
using namespace std;

bool isEven(const string& s) {
// return true;
long long i = 0;
for (auto &val: s) {
if (val == ‘1’) {
i++;
}
}
return ((!(i == 0) && (i % 2 == 0) && (i != s.size())));
}

bool isNumber(string s)
{
for (long long i = 0; i < s.length(); i++)
if (isdigit(s[i]) == false)
return false;

return true;

}

int main() {
// your code goes here
long long t;
cin >> t;
while(t–) {

    vector<unordered_map<string, string>> mp;
    vector<vector<unordered_set<string>>> validVec;

    string s;
    cin >> s;
    long long n;
    n = s.length();
    size_t size = 1;
    mp.resize(n);
    long long validSeq = 0;
   
    while(size != n) {
       long long cnt = 0;

       vector<unordered_set<string>> valid;
       for (long long i = 0; (i+(size)) <= s.size(); ++i) {
           
           string sub = s.substr(i, size);

           if (size <= 2) {
              if (mp[size].find(sub) == mp[size].end()) { 

	              mp[size].insert(make_pair(sub, to_string(0)));
  	              ++validSeq;

              }
           } else {
              if (mp[size].find(sub) == mp[size].end()) { 
	              ++validSeq;
	       
                valid.push_back(unordered_set<string>());
                mp[size].insert(make_pair(sub, (to_string(cnt)+"v")));
                valid.back().insert(sub);
                ++cnt;
                string revsub;

                if (isEven(sub)) {
                    revsub = sub;
	                reverse(revsub.begin(), revsub.end());
	                 if (mp[size].find(revsub) == mp[size].end()) {
     	                         mp[size].insert(make_pair(revsub, sub));

                         }
                }
                 if (size > 3) {
                    for (long long ssize = size-1; ssize >= 3; --ssize) { 
             //           cout << ssize<<endl;
	                 for (long long j = 0; (j+(ssize)) <= sub.size(); ++j) {
  	                  //   cout <<"sss"<<endl;

	                     string subsub = sub.substr(j, ssize);
	                     if (!isEven(subsub)) {
	                         continue;
	                     }

	                     auto strr = mp[ssize][subsub];
	                     if ((strr.back() == 'v') || (strr.back() == 'd')) {
	                         strr = strr.substr(0, strr.size()-1);
	                     }
	                     
	                     long long subpos = stoll(strr);
 	            //          cout <<"sss"<<strr<< subpos<<endl;

                    //     cout << validVec.size() <<endl;    
	                     for (auto &submod: validVec[ssize - 1][subpos])   {
	                         if ((submod != subsub) || (submod.size() != ssize)) {
                              string cpy = sub;
                               
	                         //    cout <<"d"<<endl;
	                            for (long long l = 0; l < ssize; ++l) {
	                             cpy[j + l] = submod[l];   
	                            }
	                     //     cout <<"cp="<< cpy<<"sub"<<cpy<<endl;
	                          if (mp[size].find(cpy) == mp[size].end()) {
     	                             mp[size].insert(make_pair(cpy, sub));

    	                         }
	                         if (isEven(cpy)) {

    	                         reverse(cpy.begin(), cpy.end());   

	                             if (mp[size].find(cpy) == mp[size].end()) {
     	                             mp[size].insert(make_pair(cpy, sub));

    	                         }
	                         }
	                     }
	                     }
	                 }
                 }
                 }
                 
                 }  
               else {
                 
                 auto par = mp[size][sub];
                 if((par.back() != 'v') && (par.back() != 'd')) {
                  //  cout <<"ff"<<par<<endl;
                     auto idx = mp[size][par];
                     auto si = idx.size();
                     if (idx.back() == 'v')  {
                  //       cout <<size<<idx<<sub<< "Whaaatttttfff"<<endl;
                     }
                    valid[stoll(idx.substr(0, si-1))].insert(sub);
	                 mp[size][sub] = idx.substr(0, si-1)+'d';
                 } else {
                    
                 }

                // mp[size][sub] = to_string(1); 
              }
             

                  
           }
       }
       if (size >= 3) {
	       for (auto &val: mp[size]) {
              

	           if (val.second.back() != 'd') {
	               if (val.second.back() != 'v') {
	                    auto idx = mp[size][val.second];
                         auto si = idx.size();
            
                        
    	                 valid[stoll(idx.substr(0, si-1))].insert(val.first);
	               }
	           }
	       }
	     
       }
      // cout << valid.size() <<endl;
       validVec.push_back(valid);
       // Only valid sequences
      
       ++size;
    }
    cout <<validSeq+1<<endl;

   
}
return 0;

}