class Solution:

    def balancedStringSplit(self, s: str) ->int:
        output = counter = 0
        for char in s:
            if char == 'L':
                counter -= 1
            else:
                counter += 1
            if counter == 0:
                output += 1
        return output

101b80149fa5f7a3f0a81aba3a347f5c1460521b
<mask token>

class Solution:
    <mask token>

class Solution:

    def balancedStringSplit(self, s: str) ->int:
        output = counter = 0
        for char in s:
            if char == 'L':
                counter -= 1
            else:
                counter += 1
            if counter == 0:
                output += 1
        return output
