class Solution(object):
def lengthOfLongestSubstring(self, s):
x=str(s)
if x=="":
return 0
maxlength = 1
a = [i for i in range(1,len(x)+1)]
for i in range(len(a)):
a[i]=["" for i in range(0,len(x))]
for i in range(len(x)):
abx = 1
a[i][0]+=x[i]
for j in range(1,len(a[i])+1):
if x[i]==x[i-j] or i-j<0:
break
else:
if type(a[i-1][j-1]) != int:
a[i][j]=a[i-1][j-1]+a[i][0]
abx = abx+1
if maxlength < abx:
maxlength = abx
else: break
return maxlength
在pyCharm上运行没有问题,但在这里就报错了。
希望大神可以帮帮我!!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…