Python class Solution(object): def largeGroupPositions(self, s): """ :type s: str :rtype: List[List[int]] """ result = list() before_str = "" start_index = -1 for i, alphabet in enumerate(s+ " "): if alphabet != before_str: # 현재 값과 이전 값이 다름 if i - start_index + 1 > 3: result.append([start_index, i - 1]) before_str = alphabet start_index = i return result