How to maximize the score by splitting a string in LeetCode problem 1422?