def is_all_upper_or_lower(s):
n = len(s)
count_upper = 0
for i in range(n):
if s[i].isupper():
count_upper += 1
if count_upper == 0 or count_upper == n:
return True
elif s[0].isupper() and count_upper == 1:
return True
else:
return False
while True:
s = input("请输入用户名:")
if True ==is_all_upper_or_lower(s):
print("输入正确")
else:
print("输入错误")