给定一个字符串,找出其中不含邮重复字符串的做厂子串的长度。
python:
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
if s=='':
return 0
maxcount=-float('inf')
for i,v in enumerate(s):
new_str=v
j=i-1
while s[j] not in new_str and j>-1:
new_str+=s[j]
j-=1
maxcount=max(maxcount,i-j)
return maxcount
# x=Solution()
# a='pwwkew'
# print(x.lengthOfLongestSubstring(a))
c++: