1 class Solution: 2 def balancedStringSplit(self, s: str) -> int: 3 count,res = 0,0 4 for si in s: 5 if si == 'L': 6 count += 1 7 else: 8 count -= 1 9 if count == 0: 10 res += 1 11 return res