[CodeKata] -3

김가람휘·2022년 2월 16일
1

CodeKata

목록 보기
3/28

def get_len_of_str(s):
  # 아래 코드를 작성해주세요.
  long_word = ""
  result = 0
  n = 0

  for i in range(len(s)):
    for j in range(n, len(s)):
      if s[j] not in long_word:
        long_word += s[j]
      else:
        if len(long_word) >= result:
          result = len(long_word)
          long_word = ""
          n += 1
          break
        else:
          long_word = ""
          n += 1
           
  return max(len(long_word), result)

0개의 댓글