1957. Delete Characters to Make Fancy String
On This Page
class Solution:
def makeFancyString(self, s: str) -> str:
res = []
for c in s:
if len(res) > 1 and res[-1] == res[-2] == c:
continue
res.append(c)
return ''.join(res)