This repository has been archived on 2021-10-31. You can view files and clone it, but cannot push or open issues or pull requests.
ProgrammingChallenges/repeater.py

40 lines
1,001 B
Python
Raw Normal View History

2019-05-16 15:19:31 +00:00
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])