SOURCE


let res ='pwwkew'

const computeStr =(str)=>{
    if(!str) return 0
    if(str.length ==1) return 1
    let res =[]
    let arr = str.split(''),strs ='';
    console.log(arr,1)
    arr.map((item,index)=>{
        if(strs.includes(item)){
            res.push(strs)
            let INDEX = strs.split('').findIndex(i=>i == item)
            console.log(INDEX,3)
            strs = strs.slice(INDEX+1)
        }
        strs +=item
    })
    console.log(res)
    return Math.max(...res)

}

console.log(computeStr(res))
console 命令行工具 X clear

                    
>
console