func_code_string: #include <bits/stdc++.h>   using namespace std;   int t, n, num[10], tu[500], fir[10], flag[10];   char ss[1000005];   struct node {     int v[5];   };   vector<node> p[100005];   map<long long, bool> ma[100005];   int main() {     tu[ G ] = 1;     tu[ H ] = 2;     tu[ R ] = 3;     tu[ S ] = 4;     scanf( %d , &n);     scanf( %s , &ss);     for (int i = 0; i < n; i++) {       ma[i].clear();       p[i].clear();     }     if (ss[0] !=  ? ) {       node no;       memset(no.v, 0, sizeof(no.v));       no.v[tu[ss[0]]]++;       p[0].push_back(no);     } else {       for (int i = 1; i <= 4; i++) {         node no;         memset(no.v, 0, sizeof(no.v));         no.v[i] = 1;         p[0].push_back(no);       }     }     for (int i = 1; i < n; i++) {       for (vector<node>::iterator it = p[i - 1].begin(); it != p[i - 1].end();            it++) {         node last = *it;         if (ss[i] !=  ? ) {           last.v[tu[ss[i]]]++;           long long sum = 0;           for (int k = 1; k <= 4; k++) sum = sum * 100000 + last.v[k];           if (!ma[i][sum]) {             p[i].push_back(last);             ma[i][sum] = 1;           }           continue;         }         int minv = 2000000000;         for (int j = 1; j <= 4; j++) minv = min(minv, last.v[j]);         for (int j = 1; j <= 4; j++)           if (last.v[j] == minv) {             node ne = last;             ne.v[j]++;             long long sum = 0;             for (int k = 1; k <= 4; k++) sum = sum * 100000 + ne.v[k];             if (!ma[i][sum]) {               p[i].push_back(ne);               ma[i][sum] = 1;             }           }       }     }     memset(flag, 0, sizeof(flag));     for (vector<node>::iterator it = p[n - 1].begin(); it != p[n - 1].end();          it++) {       node no = *it;       int minv = 2000000000;       for (int i = 1; i <= 4; i++) minv = min(minv, no.v[i]);       for (int i = 1; i <= 4; i++)         if (minv == no.v[i]) flag[i] = 1;     }     for (int k = 1; k <= 4; k++)       if (flag[k]) {         if (k == 1) printf( Gryffindor n );         if (k == 2) printf( Hufflepuff n );         if (k == 3) printf( Ravenclaw n );         if (k == 4) printf( Slytherin n );       }     printf(  n );   }   