func_code_string: #include <bits/stdc++.h>   inline char getThirdColor(char a, char b) {     char ret;     if (a ==  B  && b ==  G  || a ==  G  && b ==  B )       ret =  R ;     else if (a ==  B  && b ==  R  || a ==  R  && b ==  B )       ret =  G ;     else if (a ==  R  && b ==  G  || a ==  G  && b ==  R )       ret =  B ;     return ret;   }   std::unordered_map<std::string, bool> ump;   inline bool solve(std::string s, char c) {     if (s.size() == 1) {       return s[0] == c;     }     if (ump.find(s) != ump.end()) return ump[s];     bool ret = false;     for (int i = 0; i < s.size(); ++i) {       for (int j = i + 1; j < s.size(); ++j) {         if (s[i] == s[j]) {           std::string next_pass{s[i]};           for (int k = 0; k < s.size(); ++k) {             if (k != i && k != j) next_pass += s[k];           }           ret = solve(next_pass, c);         } else {           char thirdColor = getThirdColor(s[i], s[j]);           std::string next_pass{thirdColor};           for (int k = 0; k < s.size(); ++k) {             if (k != i && k != j) next_pass += s[k];           }           ret = solve(next_pass, c);         }         if (ret) break;       }       if (ret) break;     }     return ump[s] = ret;   }   int main() {     int n;     std::cin >> n;     std::string s;     std::cin >> s;     std::string modified;     modified.reserve(n);     std::unordered_map<char, int> cnt;     for (int i = 0; i < s.size(); ++i) {       if (modified.empty()) {         modified += s[i];         ++cnt[s[i]];       } else if (modified.back() == s[i] && cnt[s[i]] == 1) {         modified += s[i];         ++cnt[s[i]];       } else if (modified.back() != s[i]) {         modified += s[i];         ++cnt[s[i]];       }     }     std::vector<char> possible{ B ,  G ,  R };     for (int i = 0; i < possible.size(); ++i) {       ump.clear();       if (solve(modified, possible[i])) {         std::cout << possible[i];       }     }     std::cout <<   n ;     return 0;   }   