Write a function: def solution (S) that, given a string S of letters "L" and "R", denoting the types of shoes in line (left or r right
Answers
Answered by
6
The following codes have been written using Python.
We can create user-built functions using . S represents the string. We assign rc to represent the number of 'R's and lc to represent the number of 'L's. fc represents the number of 'R's and 'L's collectively. Appropriate conditional statements are given to retrieve the counts of 'R's and 'L's and the final output is printed.
Similar questions