def solution(S): count_r, count_l = 0,0 count_total = 0 count_total = S.count("RL") for i in S: if i == 'R': count_r += 1 continue elif(i == 'L'): count_l += 1 if(count_r == count_r): count_total += 1 return count_total