func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 100005;   int n, m;   vector<pair<int, int> > e[N];   vector<int> ans[2];   bool fla[2], flag;   int E[N], d[N];   vector<int> cnt[2];   void DFS(int first, int o, int res) {     if (flag) return;     d[first] = o;     cnt[o].push_back(first);     for (auto& i : e[first]) {       if (flag) return;       int second = (i.second + o) % 2;       if (d[i.first] == -1)         DFS(i.first, second != res, res);       else if (d[i.first] != (second != res))         flag = true;     }   }   void SOLVE(int res) {     memset(d, -1, sizeof(d));     flag = false;     for (int i(1); i <= n; i++)       if (d[i] == -1) {         cnt[0].clear();         cnt[1].clear();         DFS(i, 0, res);         if (flag) {           fla[res] = true;           return;         }         for (bool ___ = 1; ___; ___ = 0) {           int mx = (cnt[1].size() < cnt[0].size());           for (auto& i : cnt[mx]) ans[res].push_back(i);         }       }   }   int main() {     n = ({       long long first = 0;       int n = 0, c = getchar();       for (; !isdigit(c); c = getchar()) n = c ==  - ;       for (; isdigit(c); c = getchar()) first = first * 10 + c -  0 ;       n ? -first : first;     }),     m = ({       long long first = 0;       int n = 0, c = getchar();       for (; !isdigit(c); c = getchar()) n = c ==  - ;       for (; isdigit(c); c = getchar()) first = first * 10 + c -  0 ;       n ? -first : first;     });     for (int i(1); i <= m; i++) {       int first = ({         long long first = 0;         int n = 0, c = getchar();         for (; !isdigit(c); c = getchar()) n = c ==  - ;         for (; isdigit(c); c = getchar()) first = first * 10 + c -  0 ;         n ? -first : first;       }),           second = ({             long long first = 0;             int n = 0, c = getchar();             for (; !isdigit(c); c = getchar()) n = c ==  - ;             for (; isdigit(c); c = getchar()) first = first * 10 + c -  0 ;             n ? -first : first;           });       int c = ({                 char c = getchar();                 while (c ==     || c ==   n ) c = getchar();                 c;               }) ==  R ;       e[first].push_back({second, c});       e[second].push_back({first, c});     }     SOLVE(0);     SOLVE(1);     for (bool ___ = 1; ___; ___ = 0) {       int res;       if (fla[0] && fla[1])         return cout << -1 <<   n , 0;       else if (fla[0])         res = 1;       else if (fla[1])         res = 0;       else if (ans[0].size() < ans[1].size())         res = 0;       else         res = 1;       cout << ans[res].size() <<   n ;       for (auto& i : ans[res]) cout << i <<    ;     }   }   