Language: C++

#include<bits/stdc++.h>
using namespace std;

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";

string vow = "aeiou";

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

const int dx[] = { -1 , 0 , 0 , 1 } ;
const int dy[] = { 0 , -1 , 1 , 0 } ;

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

int n ;
vi p ;

vi find_l ( string s )
{
    n = s.size() ;
    vi v ;

    for ( int i=0 ; i < n ; i++ )
    {
        if ( s[i] == 'L' )
            v.pb ( i ) ;
    }
    return v ;
}

find_r ( vi v , string s , bool ver )
{
    int n = s.size() ;
    int z = v.size() ;

    for ( int i=0 ; i < n ; i++ )
    {
        if ( s[i] == 'L' ) C ;
        int ans = INT_MAX ;

        for ( int low = 0 ,hi = z-1 ; low <= hi ; )
        {
            int mid = low + hi >> 1 ;

            if ( v[mid] > i )
            {
                ans = v[mid] ;
                hi = mid - 1 ;
            }
            else low = mid + 1 ;
        }

        int t = ( ans - i )  ;
        t %= 2 ;

        int put = ans - t ;
        if ( !ver ) { put = n-1-put ; }

        p[put] ++ ;
    }
}

void solve ( int test_case )
{
    string s ; cin >> s ;

    int n = s.size() ;
    p.resize ( n ) ;

    vi v = find_l ( s ) ;
    find_r ( v , s , true ) ;

    reverse ( all ( s ) ) ;
    for ( int i=0 ; i < n ; i++ )
    {
        if ( s[i] == 'R' ) s[i] = 'L' ;
        else s[i] = 'R' ;
    }

    v.clear() ;
    v = find_l ( s ) ;
    find_r ( v , s , false ) ;

    for ( auto i : p ) cout << i << " " ; line
}

int main()
{fast
    int t = 1;
    // cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


Compiler output:
a.cc:87:1: error: ISO C++ forbids declaration of 'find_r' with no type [-fpermissive]
   87 | find_r ( vi v , string s , bool ver )
      | ^~~~~~
a.cc: In function 'int find_r(std::vector<int>, std::string, bool)':
a.cc:117:1: warning: no return statement in function returning non-void [-Wreturn-type]
  117 | }
      | ^