最近真的超懶刷
整個腦子變的鈍鈍的==
一二三四五
def shiftingLetters(self, s: str, shifts: List[List[int]]) -> str:
tmp = [0 for _ in range(len(s))]
for shft in shifts:
if shft[2]==1:
tmp[shft[0]] += 1
if shft[1]+1 < len(s):
tmp[shft[1]+1] -= 1
else:
tmp[shft[0]] -= 1
if shft[1]+1 < len(s):
tmp[shft[1]+1] += 1
ans = ""
cur_shft = 0
for i in range(len(s)):
cur_shft += tmp[i]
ans += chr(((ord(s[i])-ord('a')+cur_shft) % 26) + ord('a'))
return ans