classSolution:defminimumDeleteSum(self,s1:str,s2:str) ->int:@lru_cache(None)defhelper(i,j):if i ==len(s1)and j ==len(s2):return0elif i ==len(s1): ans =0while j <len(s2): ans +=ord(s2[j]) j +=1return anselif j ==len(s2): ans =0while i <len(s1): ans +=ord(s1[i]) i +=1return anselif s1[i]== s2[j]:returnhelper(i+1, j+1)else:returnmin(ord(s1[i]) +helper(i+1, j), ord(s2[j]) +helper(i, j+1))returnhelper(0, 0)