2414. Length of the Longest Alphabetical Continuous Substring
Содержание
class Solution:
def longestContinuousSubstring(self, s: str) -> int:
res = 0
i, j = 0, 1
while j < len(s):
res = max(res, j - i)
if ord(s[j]) - ord(s[j - 1]) != 1:
i = j
j += 1
res = max(res, j - i)
return res