<gh_stars>0
class Solution:
    def minCut(self, s: str) -> int:
        cut = [x for x in range(-1, len(s))]  
        for i in range(len(s)):
            for j in range(i, len(s)):
                if s[i:j+1] == s[i:j+1][::-1]:
                    cut[j+1] = min(cut[j+1], cut[i]+1)
                    
        return cut[-1]
