Python3 代码
n = int(input())
for i in range (n):
s = input()
count = 0
cc = ""
max = 0
mc = ""
for i in range (len(s)):
if (s[i]) == cc:
count += 1
if s[i] != cc or i == len(s) - 1:
if max < count:
max = count
mc = cc
count = 1
cc = s[i]
print (mc, max)