ACWing--每日一题-->填充(1.2)

 (python)

4966. 填充 - AcWing题库

# 输入
s=list(input())
res=0# 保存结果
# 贪心
i=1
while(i     # print(i)
    # 保存 俩值
    a=s[i]
    b=s[i-1]
    # 判断是否满足条件
    if a==b or a=="?" or b=="?":
        res+=1
        i+=1
    i+=1
        
print(res)

你可能感兴趣的:(ACWing,python,算法,贪心算法)