Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int i,n,count;
    count=0;
    string s;
    cin >> s;
    n=s.size;
    vector<char> vec(n);
    vector<int> ans(n);
    for(i=0;i<n;i++){
        vec.at(i)=s.substr(i,1);
    }
    for(i=0;i<n;i++){
        ans.at(i)=0;
    }
    for(i=0;i<n;i++){
        if(vec.at(i)=="R"&&vec.at(i+1)=="L"){
            if(count%2==0){
                ans.at(i+1)++;
                break;
            }else{
                ans.at(i)++;
                break;
            }
        }
        else if(vec.at(i)=="L"&&vec.at(i-1)=="R"){
            if(count%2==0){
                ans.at(i-1)++;
                break;
            }else{
                ans.at(i)++;
                break;
            }
        }
        else if(vec.at(i)=="R"&&vec.at(i-1)=="R"){
            vec.at(i)=vec.at(i+1);
            count++;
        }
        else if(vec.at(i)=="L"&&vec.at(i-1)=="L"){
            vec.at(i)=vec.at(i-1);
            count++;
        }
    }
    for(i=0;i<n;i++){
    cout<<ans.at(i)<<endl;
    }


}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: cannot convert 'std::__cxx11::basic_string<char>::size' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'int'
    9 |     n=s.size;
      |         ^~~~
a.cc:13:27: error: cannot convert 'std::__cxx11::basic_string<char>' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} in assignment
   13 |         vec.at(i)=s.substr(i,1);
      |                   ~~~~~~~~^~~~~
      |                           |
      |                           std::__cxx11::basic_string<char>
a.cc:19:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   19 |         if(vec.at(i)=="R"&&vec.at(i+1)=="L"){
      |            ~~~~~~~~~^~~~~
a.cc:19:39: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   19 |         if(vec.at(i)=="R"&&vec.at(i+1)=="L"){
      |                            ~~~~~~~~~~~^~~~~
a.cc:28:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   28 |         else if(vec.at(i)=="L"&&vec.at(i-1)=="R"){
      |                 ~~~~~~~~~^~~~~
a.cc:28:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   28 |         else if(vec.at(i)=="L"&&vec.at(i-1)=="R"){
      |                                 ~~~~~~~~~~~^~~~~
a.cc:37:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   37 |         else if(vec.at(i)=="R"&&vec.at(i-1)=="R"){
      |                 ~~~~~~~~~^~~~~
a.cc:37:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   37 |         else if(vec.at(i)=="R"&&vec.at(i-1)=="R"){
      |                                 ~~~~~~~~~~~^~~~~
a.cc:41:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   41 |         else if(vec.at(i)=="L"&&vec.at(i-1)=="L"){
      |                 ~~~~~~~~~^~~~~
a.cc:41:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   41 |         else if(vec.at(i)=="L"&&vec.at(i-1)=="L"){
      |                                 ~~~~~~~~~~~^~~~~