题解 | #字符串编码#
字符串编码
https://www.nowcoder.com/practice/56a487c342a64d2ea4c3a0b0144b42d0
a,b= input(),[]
for i in a:
if len(b) == 0:
b.append(1)
b.append(i)
elif b[-1] != i:
b.append(1)
b.append(i)
else:
b[-2] = b[-2] + 1
print("".join(map(str, b)))
11行解决战斗
美的集团公司福利 727人发布
查看14道真题和解析