func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, cnt0 = 3;   int g, r, b;   bool markb = true, markg = true, markr = true;   char id[ Z ][ Z ];   vector<char> st, m;   int tt[500];   int main() {     scanf( %d n , &n);     for (int i = 1; i <= n; ++i) {       char ch;       scanf( %c , &ch);       if (ch ==  B ) {         ++b;         cnt0 -= markb;         markb = false;       }       if (ch ==  G ) {         ++g;         cnt0 -= markg;         markg = false;       }       if (ch ==  R ) {         ++r;         cnt0 -= markr;         markr = false;       }     }     if (b >= 1 && g >= 1 && r >= 1) {       printf( BGR );       return 0;     }     if (cnt0 == 2) {       if (b) {         printf( B );         return 0;       }       if (g) {         printf( G );         return 0;       }       if (r) {         printf( R );         return 0;       }     }     if (g == 0) {       if (r >= 2 && b >= 2) {         printf( BGR );         return 0;       }     }     if (r == 0) {       if (g >= 2 && b >= 2) {         printf( BGR );         return 0;       }     }     if (b == 0) {       if (g >= 2 && r >= 2) {         printf( BGR );         return 0;       }     }     markb = markg = markr = false;     id[ G ][ G ] =  G ;     id[ R ][ R ] =  R ;     id[ B ][ B ] =  B ;     id[ G ][ R ] = id[ R ][ G ] =  B ;     id[ B ][ R ] = id[ R ][ B ] =  G ;     id[ G ][ B ] = id[ B ][ G ] =  R ;     if (b >= 1) m.push_back( B );     if (b >= 2) m.push_back( B );     if (g >= 1) m.push_back( G );     if (g >= 2) m.push_back( G );     if (r >= 1) m.push_back( R );     if (r >= 2) m.push_back( R );     for (int i = 1; i <= m.size(); ++i) tt[i] = i;     do {       st.clear();       for (int i = 1; i <= m.size(); ++i) st.push_back(m[tt[i] - 1]);       for (int i = 0; i < st.size() - 1;) {         st.push_back(id[st[i]][st[i + 1]]);         i += 2;       }       if (st.back() ==  B ) markb = true;       if (st.back() ==  G ) markg = true;       if (st.back() ==  R ) markr = true;     } while (next_permutation(tt + 1, tt + m.size() + 1));     if (markb) printf( B );     if (markg) printf( G );     if (markr) printf( R );     return 0;     return 0;   }   