def compressedString(self,word):
ans=[]
num=1
for i in range(len(word)):
if i<len(word)-1 and word[i]==word[i+1] and num<9:
num=num+1
else:
ans.append(str(num))
ans.append(word[i])
num=1
return ''.join(ans)
都修完程設一二跟python了
還寫成這一坨答辯
這輩子我就這樣了
----
Sent from BePTT on my Samsung SM-S9210
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 101.136.50.83 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1730744778.A.B37.html