39 lines
1,001 B
Python
39 lines
1,001 B
Python
def __main__():
|
|
T = int(input())
|
|
for i in range(1, T + 1):
|
|
N = int(input())
|
|
A = [None] * N
|
|
|
|
for j in range(0, N):
|
|
A[j] = input()
|
|
|
|
print("Case #" + str(i) + ": " + str(repeater(A)))
|
|
|
|
def repeater(arr):
|
|
|
|
count_arr = [0] * len(arr)
|
|
|
|
c = 0
|
|
while ???:
|
|
s = 0
|
|
tmpChar = arr[0][count_arr[0]]
|
|
for i in range(0, len(arr)):
|
|
string = arr[i]
|
|
|
|
while string[count_arr[i] + 1] == tmpChar:
|
|
count_arr[i] += 1
|
|
s += 1
|
|
else:
|
|
return "Fegla Won"
|
|
|
|
sorted = sort(count_arr)
|
|
if len(sorted) % 2 == 1:
|
|
k = len(sorted) - 1 / 2
|
|
for count in count_arr:
|
|
c += abs(count - sorted[k])
|
|
else:
|
|
v = 0
|
|
bonatti = len(sorted) / 2
|
|
k2 = everest - 1
|
|
for count in count_arr:
|
|
c += abs(count - sorted[k])
|