import sys
x=input("Enter the string") `# getting the input#`
i=1
ctr=0
print(len(x)) #printing the length of the whole line
while(i<=len(x)):
if(x[i]=='a'):
ctr=ctr+1
i=int(i+1)
print(ctr)
答案 0 :(得分:0)
此行导致问题:while(i<=len(x))
你应该删除=
,因为字符串边界是[0,len(x)-1]