#include <bits/stdc++.h>   using namespace std;   const long long N = 2e5 + 7;   long long l[N], r[N];   long long a[N];   bool used[N];   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     long long n;     cin >> n;     string second;     cin >> second;     for (long long i = 0; i < n; ++i) cin >> a[i];     set<pair<long long, long long> > ms;     for (long long i = 0; i < n; ++i) {       l[i] = i - 1;       r[i] = i + 1;     }     r[n] = n;     for (long long i = 0; i < n - 1; ++i) {       if (second[i] != second[i + 1]) {         ms.insert(make_pair(abs(a[i] - a[i + 1]), i));       }     }     vector<pair<long long, long long> > ans;     while (ms.size()) {       long long i = ms.begin()->second;       ms.erase(ms.begin());       if (used[i] || used[r[i]]) continue;       ans.push_back(make_pair(i, r[i]));       used[i] = used[r[i]] = 1;       long long tl = l[i];       long long tr = r[r[i]];       ms.erase(make_pair(abs(a[tl] - a[i]), tl));       ms.erase(make_pair(abs(a[tr] - a[r[i]]), r[i]));       if (tl != -1) r[tl] = tr;       if (tr != n) l[tr] = tl;       if (tl != -1 && tr != n && second[tl] != second[tr]) {         ms.insert(make_pair(abs(a[tl] - a[tr]), tl));       }     }     cout << ans.size() <<   n ;     for (auto e : ans) cout << e.first + 1 <<     << e.second + 1 <<   n ;   }   