func_code_string: #include <bits/stdc++.h>   using namespace std;   int n;   string s;   set<vector<int> > DP[10001];   bool R[4];   int main() {     cin >> n;     cin >> s;     for (int i = 0; i < s.size(); i++)       if (s[i] ==  G )         s[i] =  0 ;       else if (s[i] ==  S )         s[i] =  1 ;       else if (s[i] ==  H )         s[i] =  2 ;       else if (s[i] ==  R )         s[i] =  3 ;     vector<int> E(4, 0);     DP[0].insert(E);     for (int i = 0; i < n; i++) {       set<vector<int> >::iterator it;       for (it = DP[i].begin(); it != DP[i].end(); it++) {         vector<int> T;         T = *it;         int q = min(T[0], min(T[1], min(T[2], T[3])));         for (int j = 0; j < 4; j++) {           if ((s[i] !=  ?  && (j == (s[i] -  0 )) ||                (s[i] ==  ?  && T[j] == q))) {             vector<int> N;             N = T;             N[j]++;             int p = min(N[0], min(N[1], min(N[2], N[3])));             for (int l = 0; l < 4; l++) N[l] -= p;             DP[i + 1].insert(N);           }         }       }     }     set<vector<int> >::iterator it;     for (it = DP[n].begin(); it != DP[n].end(); it++) {       vector<int> T;       T = *it;       int q = min(T[0], min(T[1], min(T[2], T[3])));       for (int j = 0; j < 4; j++)         if (T[j] == q) R[j] = true;     }     if (R[0]) cout <<  Gryffindor  << endl;     if (R[2]) cout <<  Hufflepuff  << endl;     if (R[3]) cout <<  Ravenclaw  << endl;     if (R[1]) cout <<  Slytherin  << endl;     cin >> n;     return 0;   }   