其實 蠻男的 寫了很久 我就這樣了 一二三四五 def makeFancyString(self, s: str) -> str: ans = "" pre_c = "" cur_cnt = 1 for c in s: if c == pre_c: cur_cnt += 1 else: pre_c = c cur_cnt = 1 if cur_cnt<3: ans += c return ans -- ※ 發信站: 批踢踢實業坊(ptt.org.tw), 來自: 125.229.37.69 (臺灣) ※ 文章網址: https://ptt.org.tw/Marginalman/M.1730469829.A.03E