백준 2941 : 크로아티아 알파벳 js 풀이
·
공부/알고리즘 문제풀이
문제 링크 다음처럼 풀었다. const fs = require("fs"); const input = fs.readFileSync("/dev/stdin").toString().trim(); const chroa = ["c=", "c-", "dz=", "d-", "lj", "nj", "s=", "z="]; let result = input; const getChroa = (text, word, count = 0) => { if (text.indexOf(word) === -1) { result = result.replaceAll(word, "0"); return count; } else if (text.indexOf(word) !== -1) { count++; return getChroa(text.replac..