携程第一题
求大佬看看我着到底什么毛病,一直 13%
S = input() str_dict = {ele:count for count, ele in enumerate(S)} right = left = 0 ans = [] for count, ele in enumerate(S): right = max(right, str_dict[ele]) if count == right: ans.append(count - left + 1) left = count + 1 st = str() for i in ans: st +=str(i)+' ' print(st)