Language: C++

#include <bits/stdc++.h>
#define rep(i, end) for (long long int i=0; i<end; i++)
#define repp(i, begin, end) for (long long int i=begin; i<end; i+)
#define srt(x) sort((x).begin(), (x).end());
#define rsrt(x) sort((x).rbegin(), (x).rend());
#define deb(x) cout<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;
using namespace std;
using ll = long long int;
using vi = vector<int>;
using vll = vector<long long int>;
using vllvll = vector<vll>;
using vs = vector<string>;
ll sm(vll x) {ll sum=0; rep(i, x.size()) sum+=x[i]; return sum;}
void vdeb(string s, vll x) {cout<<s<<" = { "; rep(i, x.size()) cout<<x[i]<<' '; cout <<'}'<<endl;}

//=======================================================================================================

int main()
{
    string s;
    cin >> s;
    ll n = s.size();
    vll x(n, 0);

    ll idx = 0;
    ll rcnt = 0;
    ll lcnt = 0;
    ll tmp = 0;
    while(idx<n) {
        while(s[idx] == 'R') {
            rcnt++;
            idx++;
        }
        tmp = idx;
        while(s[tmp] == 'L') {
            lcnt++;
            tmp++;
        }
        ll sum = rcnt+lcnt;
        if(sum%2==0) {
            x[idx-1] = x[idx] = sum/2;
        }
        else if(rcnt%3==0 && rcnt>lcnt  {
            x[idx-1] = rcnt;
            x[idx] = lcnt;
        }
        else if(rcnt%3!=0&&rcnt>lcnt)
            x[idx-1] = lcnt;
            x[idx] = rcnt;
        }
        idx = tmp;
        rcnt = lcnt = 0;
    }

    rep(i,n) cout << x[i] << ' ';
    cout << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:39: error: expected ';' before '{' token
   43 |         else if(rcnt%3==0 && rcnt>lcnt  {
      |                                       ^ ~
      |                                       ;
a.cc:47:9: error: expected primary-expression before 'else'
   47 |         else if(rcnt%3!=0&&rcnt>lcnt)
      |         ^~~~
a.cc:46:10: error: expected ')' before 'else'
   46 |         }
      |          ^
      |          )
   47 |         else if(rcnt%3!=0&&rcnt>lcnt)
      |         ~~~~
a.cc:43:16: note: to match this '('
   43 |         else if(rcnt%3==0 && rcnt>lcnt  {
      |                ^
a.cc: At global scope:
a.cc:2:21: error: expected unqualified-id before 'for'
    2 | #define rep(i, end) for (long long int i=0; i<end; i++)
      |                     ^~~
a.cc:55:5: note: in expansion of macro 'rep'
   55 |     rep(i,n) cout << x[i] << ' ';
      |     ^~~
a.cc:55:9: error: 'i' does not name a type; did you mean 'vi'?
   55 |     rep(i,n) cout << x[i] << ' ';
      |         ^
a.cc:2:45: note: in definition of macro 'rep'
    2 | #define rep(i, end) for (long long int i=0; i<end; i++)
      |                                             ^
a.cc:55:9: error: 'i' does not name a type; did you mean 'vi'?
   55 |     rep(i,n) cout << x[i] << ' ';
      |         ^
a.cc:2:52: note: in definition of macro 'rep'
    2 | #define rep(i, end) for (long long int i=0; i<end; i++)
      |                                                    ^
a.cc:56:5: error: 'cout' does not name a type
   56 |     cout << endl;
      |     ^~~~
a.cc:57:5: error: expected unqualified-id before 'return'
   57 |     return 0;
      |     ^~~~~~
a.cc:58:1: error: expected declaration before '}' token
   58 | }
      | ^