'''
URL: https://leetcode.com/problems/maximum-score-after-splitting-a-string/

Difficulty: Easy

Title: Maximum Score After Splitting a String
'''

################### Code ###################

class Solution:

    def countChar(self, s, char):

        return sum([1 for ch in s if ch == char])

    

    def maxScore(self, s: str) -> int:

        maxScore = -float('inf')

        

        for i in range(1, len(s)):

            score = self.countChar(s[:i], "0") + self.countChar(s[i:], "1")

            maxScore = max(maxScore, score)

        

        return maxScore
