某压缩算法的基本思想是用一个数值和一个字符代替具有相同值的连续字符串(不考虑10个以上相同字符)。
例如,输入字符串“RRRGBBBBB”,压缩后为“3R1G5B”。小萧设计了以下 Python 程序来实现上述功能。
实现上述功能的python程序代码如下,请在划线处填入合适的代码。
st=input()
c,p,s=1,1,""
while ______(1)_______: #1
if st[p]==st[p-1]:
c+=1
else:
s+=str(c)+st[p-1]
______(2)______#2
_____(3)______#3
s+=str(c)+st[p-1]
if _____(4)_______:
print('No')
else:
print(s)