func_code_string: #include <bits/stdc++.h>   using namespace std;   char in[100000 + 1];   int main() {     vector<array<int, 4> > cur, nex;     cur.push_back(array<int, 4>{{}});     int n;     scanf( %d , &n);     scanf( %s , in);     for (int i = 0; i < n; i++) {       int p = -1;       switch (in[i]) {         case  G :           p = 0;           break;         case  H :           p = 1;           break;         case  R :           p = 2;           break;         case  S :           p = 3;           break;       }       if (p >= 0) {         for (int i = 0; i < cur.size(); i++) {           cur[i][p]++;         }         continue;       }       nex.clear();       for (auto a : cur) {         int m = a[0];         for (int i = 1; i < 4; i++) {           m = min(m, a[i]);         }         for (int i = 0; i < 4; i++) {           if (a[i] == m) {             nex.push_back(a);             nex.back()[i]++;           }         }       }       sort(nex.begin(), nex.end());       nex.resize(unique(nex.begin(), nex.end()) - nex.begin());       nex.swap(cur);     }     const char* str[] = { Gryffindor ,  Hufflepuff ,  Ravenclaw ,  Slytherin };     for (int i = 0; i < 4; i++) {       for (auto a : cur) {         int m = a[0];         for (int i = 1; i < 4; i++) {           m = min(m, a[i]);         }         if (a[i] == m) {           puts(str[i]);           break;         }       }     }     return 0;   }   