Language: C++

import java.util.*;
import java.io.*;
import static java.lang.System.*;

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;
  private boolean hasNextByte() {
      if (ptr < buflen) {
          return true;
      }else{
          ptr = 0;
          try {
              buflen = in.read(buffer);
          } catch (IOException e) {
              e.printStackTrace();
          }
          if (buflen <= 0) {
              return false;
          }
      }
      return true;
  }
  private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
  private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
  public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
  public String next() {
      if (!hasNext()) throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while(isPrintableChar(b)) {
          sb.appendCodePoint(b);
          b = readByte();
      }
      return sb.toString();
  }
  public long nextLong() {
      if (!hasNext()) throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
          minus = true;
          b = readByte();
      }
      if (b < '0' || '9' < b) {
          throw new NumberFormatException();
      }
      while(true){
          if ('0' <= b && b <= '9') {
              n *= 10;
              n += b - '0';
          }else if(b == -1 || !isPrintableChar(b)){
              return minus ? -n : n;
          }else{
              throw new NumberFormatException();
          }
          b = readByte();
      }
  }
  public int nextInt() {
      long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
      return (int) nl;
  }
  public double nextDouble() { return Double.parseDouble(next());}
}

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    FastScanner sc = new FastScanner();
    String S = sc.next();
    int firstL = -1;
    char prev = 'R';
    int kids[] = new int[S.length()];
    int cntR = 0;
    int cntL = 0;
    for(int i=0; i<S.length(); i++){
      if(S.charAt(i) == 'L'){
        cntL++;
        if(prev == 'R'){
          firstL = i;
          kids[i-1] += (cntR+1) / 2;
          kids[i] += cntR / 2;
          cntR = 0;
        }
        prev = 'L';
      }else{
        cntR++;
        if(prev == 'L'){
          kids[firstL-1] += cntL / 2;
          kids[firstL] += (cntL+1) / 2;
          cntL = 0;
        }
        prev = 'R';
      }
    }
    if(cntL % 2 == 0){
      kids[firstL-1] += cntL / 2;
      kids[firstL] += cntL / 2;
    }else{
      kids[firstL-1] += cntL / 2;
      kids[firstL] += cntL / 2 + 1;
    }
    for(int i=0; i<S.length(); i++){
      out.print(kids[i] + " ");
    }
  }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import static java.lang.System.*;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:10: error: expected ':' before 'final'
    6 |   private final InputStream in = System.in;
      |          ^~~~~~
      |          :
a.cc:6:11: error: 'final' does not name a type
    6 |   private final InputStream in = System.in;
      |           ^~~~~
a.cc:7:10: error: expected ':' before 'final'
    7 |   private final byte[] buffer = new byte[1024];
      |          ^~~~~~
      |          :
a.cc:7:11: error: 'final' does not name a type
    7 |   private final byte[] buffer = new byte[1024];
      |           ^~~~~
a.cc:8:10: error: expected ':' before 'int'
    8 |   private int ptr = 0;
      |          ^~~~
      |          :
a.cc:9:10: error: expected ':' before 'int'
    9 |   private int buflen = 0;
      |          ^~~~
      |          :
a.cc:10:10: error: expected ':' before 'boolean'
   10 |   private boolean hasNextByte() {
      |          ^~~~~~~~
      |          :
a.cc:10:11: error: 'boolean' does not name a type; did you mean 'bool'?
   10 |   private boolean hasNextByte() {
      |           ^~~~~~~
      |           bool
a.cc:26:10: error: expected ':' before 'int'
   26 |   private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
      |          ^~~~
      |          :
a.cc:27:10: error: expected ':' before 'static'
   27 |   private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
      |          ^~~~~~~
      |          :
a.cc:27:18: error: 'boolean' does not name a type; did you mean 'bool'?
   27 |   private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
      |                  ^~~~~~~
      |                  bool
a.cc:28:9: error: expected ':' before 'boolean'
   28 |   public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
      |         ^~~~~~~~
      |         :
a.cc:28:10: error: 'boolean' does not name a type; did you mean 'bool'?
   28 |   public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
      |          ^~~~~~~
      |          bool
a.cc:29:9: error: expected ':' before 'String'
   29 |   public String next() {
      |         ^~~~~~~
      |         :
a.cc:29:10: error: 'String' does not name a type
   29 |   public String next() {
      |          ^~~~~~
a.cc:39:9: error: expected ':' before 'long'
   39 |   public long nextLong() {
      |         ^~~~~
      |         :
a.cc:63:9: error: expected ':' before 'int'
   63 |   public int nextInt() {
      |         ^~~~
      |         :
a.cc:68:9: error: expected ':' before 'double'
   68 |   public double nextDouble() { return Double.parseDouble(next());}
      |         ^~~~~~~
      |         :
a.cc:69:2: error: expected ';' after class definition
   69 | }
      |  ^
      |  ;
a.cc: In member function 'int FastScanner::readByte()':
a.cc:26:32: error: 'hasNextByte' was not declared in this scope
   26 |   private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
      |                                ^~~~~~~~~~~
a.cc:26:54: error: 'buffer' was not declared in this scope; did you mean 'buflen'?
   26 |   private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
      |                                                      ^~~~~~
      |                                                      buflen
a.cc: In member function 'long int FastScanner::nextLong()':
a.cc:40:12: error: 'hasNext' was not declared in this scope
   40 |       if (!hasNext()) throw new NoSuchElementException();
      |            ^~~~~~~
a.cc:40:33: error: expected type-specifier before 'NoSuchElementException'
   40 |       if (!hasNext()) throw new NoSuchElementException();
      |                                 ^~~~~~~~~~~~~~~~~~~~~~
a.cc:42:7: error: 'boolean' was not declared in this scope; did you mean 'bool'?
   42 |       boolean minus = false;
      |       ^~~~~~~
      |       bool
a.cc:45:11: error: 'minus' was not declared in this scope
   45 |           minus = true;
      |           ^~~~~
a.cc:49:21: error: expected type-specifier before 'NumberFormatException'
   49 |           throw new NumberFormatException();
      |                     ^~~~~~~~~~~~~~~~~~~~~
a.cc:55:32: error: 'isPrintableChar' was not declared in this scope
   55 |           }else if(b == -1 || !isPrintableChar(b)){
      |                                ^~~~~~~~~~~~~~~
a.cc:56:22: error: 'minus' was not declared in this scope
   56 |               return minus ? -n : n;
      |                      ^~~~~
a.cc:58:25: error: expected type-specifier before 'NumberFormatException'
   58 |               throw new NumberFormatException();
      |                         ^~~~~~~~~~~~~~~~~~~~~
a.cc: In member function 'int FastScanner::nextInt()':
a.cc:65:16: error: 'Integer' was not declared in this scope
   65 |       if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
      |                ^~~~~~~
a.cc:65:71: error: expected type-specifier before 'NumberFormatException'
   65 |       if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
      |                                                                       ^~~~~~~~~~~~~~~~~~~~~
a.cc: In member function 'double FastScanner::nextDouble()':
a.cc:68:39: error: 'Double' was not declared in this scope; did you mean 'double'?
   68 |   public double nextDouble() { return Double.parseDouble(next());}
      |                                       ^~~~~~
      |                                       double
a.cc:68:58: error: 'next' was not declared in this scope; did you mean 'nextInt'?
   68 |   public double nextDouble() { return Double.parseDouble(next());}
      |                                                          ^~~~
      |                                                          nextInt
a.cc: At global scope:
a.cc:72:9: error: expected ':' before 'static'
   72 |   public static final int MOD = 1000000007;
      |         ^~~~~~~
      |         :
a.cc:72:17: error: 'final' does not name a type
   72 |   public static final int MOD = 1000000007;
      |                 ^~~~~
a.cc:73:9: error: expected ':' before 'static'
   73 |   public static final int INF = 1000000000;
      |         ^~~~~~~
      |         :
a.cc:73:17: error: 'final' does not name a type
   73 |   public static final int INF = 1000000000;
      |                 ^~~~~
a.cc:74:9: error: expected ':' before 'static'
   74 |   public static void main(String[] args) {
      |         ^~~~~~~
      |         :
a.cc:74:27: error: 'String' has not been declared
   74 |   public static void main(String[] args) {
      |                           ^~~~~~
a.cc:74:36: error: expected ',' or '...' before 'args'
   74 |   public static void main(String[] args) {
      |                                    ^~~~
a.cc:113:2: error: expected ';' after class definition
  113 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:75:22: error: conversion from 'FastScanner*' to non-scalar type 'FastScanner' requested
   75 |     FastScanner sc = new FastScanner();
      |                      ^~~~~~~~~~~~~~~~~
a.cc:76:5: error: 'String' was not declared in this scope
   76 |     String S = sc.next();
      |     ^~~~~~
a.cc:79:26: error: 'S' was not declared in this scope
   79 |     int kids[] = new int[S.length()];
      |                          ^
a.cc:79:18: error: initializer fails to determine size of 'kids'
   79 |     int kids[] = new int[S.length()];
      |                  ^~~~~~~~~~~~~~~~~~~
a.cc:79:18: error: array must be initialized with a brace-enclosed initializer
a.cc:110:7: error: 'out' was not declared in this scope
  110 |       out.print(kids[i] + " ");
      |       ^~~