s
중 숫자형 문자열만 추출2
배열 순회function secondHighest(s: string): number {
const onlyNum = s.replace(/[a-z]/g, "")
const numArr = [...onlyNum].map(Number)
const maxNum = Math.max(...numArr)
let curMax = -1
for(const num of numArr) {
if(num <= curMax) continue
if(num === maxNum) continue
curMax = Math.max(curMax, num)
}
return curMax
};