NZEC Error: Python

nzec
python

#1

def main():

n = int(raw_input())
initList = []
tempMax = 0
	
for i in range (0,n):
	initList.append(raw_input())

initList.sort()

i = 0
for i in range (0,n-1):
	l0 = len(initList*)
	l1 = len(initList[i+1])
	k = 0
	while (initList*[k]==initList[i+1][k] and k<l0 and k<l1):
		k+=1
	if (k>tempMax):
			tempMax = k
print(tempMax)

return 0;

main()

Well…
I tried everything…
removing the main() and running the code in Body also, still getting NZEC error.
Please someone help me


#2

there is no need return 0 for python!


#3

Got it…
little problem with the code only


#4

the problem here is you have to check the boundary of the 2 strings before trying to access the k-th character.

while (k<l0 and k<l1 and initList*[k]==initList[i+1][k]):

instead of :

while (initList*[k]==initList[i+1][k] and k<l0 and k<l1):

should be ok.


#5

then do you have any idea about NZEC error then


#6

what was the problem, please share


#7

So that results in RUNTIME error, I seriously doubt my understanding of python or may be runtime error. Enlighten me please!