不符合循环条件,当然不会进入循环啊。即便进入循环也会陷入死循环,因为无论是否大写字母,c,d都应该加1.建议用遍历语句for。
S = input()
b = len(S)
for c in range(b):
if S[c].istitle():
print(c+1)
如果实在想用while循环的话:
S = input()
b = len(S)
c = 0
d = 1
while b != c:
if S[c].istitle():
print(d)
c+=1
d+=1
else:
c+=1
d+=1