str: 텍스트
return: 중복되지 않은 알파벳 길이 (숫자 반환)
예를 들어,
str = "abcabcabc"
return은 3
=> 'abc' 가 제일 길기 때문
str = "aaaaa"
return은 1
=> 'a' 가 제일 길기 때문
str = "sttrg"
return은 3
=> 'trg' 가 제일 길기 때문
const getLengthOfStr = str => {
len = str.length;
temp = ""
rlt = []
max = 0
j = 1
for(let i=0; i<(len-2); i++){
temp = str[i]
//console.log(temp)
//console.log(str[j])
j=i+1
while(temp.indexOf(str[j])<0 && j<len){
if(str[j]!=undefined){
temp = temp + str[j]
//console.log(temp)
j++
}
//console.log(str[j])
}
rlt.push(temp)
if(max < temp.length){
max = temp.length;
}
temp=""
}
console.log(rlt)
return max
}
getLengthOfStr("abcabc")
//console.log("abc".indexOf("d"))