목록문제 (388)
sm 기술 블로그
let input = require('fs').readFileSync('/dev/stdin').toString().split(); let str = input[0].toUpperCase(); let T = Array.from(new Set(str)); let max = 0; let result = ''; for(let i = 0; i < T.length-1; i++){ let N = str.match(new RegExp(T[i], "g")).length; if(max < N){ max = N; result = T[i]; } else if(max == N){ result = '?'; } } console.log(result);
let input = require('fs').readFileSync('/dev/stdin').toString().trim().split('\n'); let T = parseInt(input[0]); let answer = ''; for(let i = 1; i
let input = require('fs').readFileSync(0).toString().split(); let arr = []; for(let i = 0 ; i < 26; i++){ arr[i] = -1; } // console.log(input[0].charCodeAt(0)-97); for(let j = 0; j < input[0].length; j++){ let num = input[0].charCodeAt(j)-97; if(arr[num] == -1){ arr[num] = j; } } console.log(...arr);