Problem Brief
Count Tiles in 1D Othello
OA
1D Othello is a board game played with Othello tiles and a horizontal grid. The game is played as follows:
A transcript of 1D Othello is written in a string consisting of L and R. If the i-th letter of the transcript is L, that means a tile (a black tile when i is an odd number and a white tile when i is an even number) was placed to the left of the tiles already on the board, and if it is R that means a tile was placed to the right of the tiles already on the board.
You are given a transcript S of the game. Please display the respective number of black and white tiles at conclusion of the game.
1Example 1
Input
s = "RRLL"
Output
[0, 6]
Explanation
The game proceeded as follows:
bw(initial)->bbb->bbbw->bbbbw->wwwwww
Hence, all six white tiles at the end of the game.
2Example 2
Input
s = "LLRLRLR"
Output
[3, 6]
Explanation
đŁ