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

 

posted on 2019-10-15 08:11  Sempron2800+  阅读(218)  评论(0编辑  收藏  举报