func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     assert(1 <= n && n <= (int)(2e5));     string sex;     cin >> sex;     assert(sex.size() == n);     for (int i = 0; i < n; ++i) {       assert(sex[i] ==  B  || sex[i] ==  G );     }     vector<int> a(n);     for (int i = 0; i < n; ++i) {       cin >> a[i];       assert(1 <= a[i] && a[i] <= (int)(1e7));     }     vector<int> pre(n), nxt(n);     priority_queue<pair<int, pair<int, int> >,                    vector<pair<int, pair<int, int> > >,                    greater<pair<int, pair<int, int> > > >         pq;     for (int i = 0; i < n; ++i) {       pre[i] = i - 1;       nxt[i] = i + 1;       if (i > 0 && sex[i - 1] != sex[i]) {         pq.push(make_pair(abs(a[i - 1] - a[i]), make_pair(i - 1, i)));       }     }     vector<bool> mark(n, true);     vector<pair<int, int> > result;     while (!pq.empty()) {       int i = pq.top().second.first;       int j = pq.top().second.second;       pq.pop();       if (mark[i] && mark[j]) {         mark[i] = false;         mark[j] = false;         result.push_back(make_pair(i, j));         i = pre[i];         j = nxt[j];         if (i != -1) {           nxt[i] = j;         }         if (j != n) {           pre[j] = i;         }         if (i != -1 && j != n && sex[i] != sex[j] && mark[i] && mark[j]) {           pq.push(make_pair(abs(a[i] - a[j]), make_pair(i, j)));         }       }     }     cout << result.size() << endl;     for (int i = 0; i < result.size(); ++i) {       cout << result[i].first + 1 <<     << result[i].second + 1 << endl;     }     return 0;   }   