请使用以下代码:
A_count = 0
B_count = 0
n = int(input("请输入读入次数: "))
for i in range(n):
s = input("请输入字符串: ")
if s == "A":
A_count += 1
elif s == "B":
B_count += 1
if A_count > B_count:
print("A")
elif A_count < B_count:
print("B")
else:
print("相同")
这段代码将会读入n次