sCSUVbuM@tg says to 電訊台 results = [] for [l, r] in (all combinations of l, r where l >= 0, r < TLen, l <= r): cnt = 0 while T[l] == T[r]: cnt += 1 l -= 1 r += 1 if l < 0 or r >= TLen: break