func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long M = 1e9 + 7;   const long long N = 5e5 + 1;   bool prime[N];   void solve() {     long long n, k;     cin >> n >> k;     string s;     cin >> s;     vector<vector<long long>> v(k);     long long cnt = 0, c = 0;     string t = s;     bool f = 0;     while (1) {       bool b = 0;       for (long long i = 0; i < n; i++) {         if (t[i] ==  R  && t[i + 1] ==  L ) {           if (cnt >= k) {             f = 1;             break;           }           b = 1;           t[i] =  L ;           t[i + 1] =  R ;           i++;           v[cnt].push_back(i);           c++;         }       }       if (f) break;       if (b == 0) break;       cnt++;     }     if (cnt > k || c < k || f) {       cout << -1 <<   n ;       return;     } else if (cnt == k) {       for (auto i : v) {         cout << i.size() <<    ;         for (auto j : i) cout << j <<    ;         cout <<   n ;       }     } else {       long long t = cnt - 1, b = k - 1;       while (t < b) {         long long m = v[t].size();         while (!v[t].empty()) {           v[b].push_back(v[t].back());           b--;           v[t].pop_back();           if (t >= b) break;         }         if (t == b && v[t].size()) break;         t--;       }       for (auto i : v) {         cout << i.size() <<    ;         for (auto j : i) cout << j <<    ;         cout <<   n ;       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t = 1;     while (t--) solve();   }   