class Solution:

    def balancedStringSplit(self, s: str) ->int:
        output = 0
        hashmap = {'L': 0, 'R': 0}
        for i in range(len(s)):
            hashmap[s[i]] += 1
            if hashmap['L'] == hashmap['R']:
                hashmap['L'] = hashmap['R'] = 0
                output += 1
        return output

e5e75313603acb8446e23d4b1e3683cd1c34517c
<mask token>

class Solution:
    <mask token>

class Solution:

    def balancedStringSplit(self, s: str) ->int:
        output = 0
        hashmap = {'L': 0, 'R': 0}
        for i in range(len(s)):
            hashmap[s[i]] += 1
            if hashmap['L'] == hashmap['R']:
                hashmap['L'] = hashmap['R'] = 0
                output += 1
        return output
