Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <tuple>
#include <string>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  string s;
  cin >> s;
  int m;
  int h[s.length];
  REP(i, s.length) {h[i] = 1;}
  REP(i, s.length) 
  {
    char c = s[i];
    if(c == 'R')
    {
      m = i;
      while(c == s[m])
      {     
		m++;
      }
      if((m - i) % 2 == 0)
      {
        h[m] += 1;
        h[i] -= 1;
      }
      else
      {
        h[m - 1] += 1;
        h[i] -= 1;
      }
    }
    else
    {
      m = i;
      while(c == s[m])
      {   
		m--;
      }
      if((m - i) % 2 == 0)
      {
        h[m] += 1;
        h[i] -= 1;
      }
      else
      {
        h[m + 1] += 1;
        h[i] -= 1;
      }
    }

  }
      REP(i, s.length)
    {
      cout << h[i];
    }
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: cannot convert 'std::__cxx11::basic_string<char>::length' 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 'long unsigned int'
   24 |   int h[s.length];
      |                 ^
a.cc:24:11: error: size of array 'h' has non-integral type '<unresolved overloaded function type>'
   24 |   int h[s.length];
      |         ~~^~~~~~
a.cc:25:12: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   25 |   REP(i, s.length) {h[i] = 1;}
      |          ~~^~~~~~
a.cc:12:38: note: in definition of macro 'REP'
   12 | #define REP(i, n) for(int i = 0; i < n; i++)
      |                                      ^
a.cc:26:12: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   26 |   REP(i, s.length)
      |          ~~^~~~~~
a.cc:12:38: note: in definition of macro 'REP'
   12 | #define REP(i, n) for(int i = 0; i < n; i++)
      |                                      ^
a.cc:67:16: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   67 |       REP(i, s.length)
      |              ~~^~~~~~
a.cc:12:38: note: in definition of macro 'REP'
   12 | #define REP(i, n) for(int i = 0; i < n; i++)
      |                                      ^