leetcode1003】的更多相关文章

We are given that the string "abc" is valid. From any valid string V, we may split V into two pieces X and Y such that X + Y (X concatenated with Y) is equal to V.  (X or Y may be empty.)  Then, X + "abc" + Y is also valid. If for exam…
class Solution: def isValid(self, S: str) -> bool: n = len(S) if n % 3 != 0: return False while n!=0: i = S.find('abc') if i == -1: return False else: S = S[0:i] + S[i+3:] n = len(S) return True…