Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
#define int long long
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    string s;
    cin>>s;
    int index=0;
    int rr;
    int lr=0;
    int center=0;
    vector<int>a(s.size());
    for(index=0;index<s.size();index++){
        if(s.at(index)=='R'){
            if(s.at(index+1)=='L'){
                center=index;
                rr=index+1;
                int tmp;
                for(rr=index+1;rr<s.size();rr++){
                    if(s.at(rr)=='R'){
                        int l_cnt=rr-center-1;
                        int r_cnt=center-lr+1;
                        // cout<<"lr"<<lr<<"center"<<center<<"rr"<<rr<<endl;
                        // cout<<l_cnt<<"A"<<r_cnt<<endl;
                        if((rr-lr)%2==0){
                            a.at(center)=(rr-lr)/2;
                            a.at(center+1)=(rr-lr)/2;
                            // cout<<center<<"AAA"<<endl;
                        }
                        else if(l_cnt>r_cnt && l_cnt%2==1){
                            a.at(center)=(rr-lr)/2;
                            a.at(center+1)=(rr-lr)/2+1;
                        }
                        else if(l_cnt>r_cnt && l_cnt%2==0){
                            a.at(center)=(rr-lr)/2+1;
                            a.at(center+1)=(rr-lr)/2;
                        }
                        else if(l_cnt<r_cnt && r_cnt%2==1){
                            a.at(center)=(rr-lr)/2+1;
                            a.at(center+1)=(rr-lr)/2;
                        }
                        else if(l_cnt<r_cnt && r_cnt%2==0){
                            a.at(center)=(rr-lr)/2;
                            a.at(center+1)=(rr-lr)/2+1;
                            // cout<<"AAA"<<endl;
                        }
                        tmp=rr;
                        break;
                    }
                    if(rr==s.size()-1){
                        rr++;
                        // cout<<"lr"<<lr<<"center"<<center<<"rr"<<rr<<endl;
                        int l_cnt=rr-center-1;
                        int r_cnt=center-lr+1;
                        if((rr-lr)%2==0){
                            a.at(center)=(rr-lr)/2;
                            a.at(center+1)=(rr-lr)/2;
                            // cout<<center<<"AAA"<<endl;
                        }
                        else if(l_cnt>r_cnt && l_cnt%2==1){
                            a.at(center)=(rr-lr)/2;
                            a.at(center+1)=(rr-lr)/2+1;
                        }
                        else if(l_cnt>r_cnt && l_cnt%2==0){
                            a.at(center)=(rr-lr)/2+1;
                            a.at(center+1)=(rr-lr)/2;
                        }
                        else if(l_cnt<r_cnt && r_cnt%2==1){
                            a.at(center)=(rr-lr)/2+1;
                            a.at(center+1)=(rr-lr)/2;
                        }
                        else if(l_cnt<r_cnt && l_cnt%2==0){
                            a.at(center)=(rr-lr)/2;
                            a.at(center+1)=(rr-lr)/2+1;
                        }
                        break;
                    }
                }
                lr=tmp;
                index=tmp-1;
                if(rr>=s.size()){
                    break;
                }
            }
        }
    }
    for(int i=0;i<s.size();i++){
        cout<<a.at(i)<<endl;
    }





    // return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'