1576. Replace All 's to Avoid Consecutive Repeating Characters
Содержание
class Solution:
def modifyString(self, s: str) -> str:
s = list(s)
n = len(s)
for i in range(n):
if s[i] == "?":
for c in "abc":
if (i and s[i - 1] == c) or (i + 1 < n and s[i + 1] == c):
continue
s[i] = c
break
return "".join(s)