function solution(s){ // 1. split 이용 const lowerS = s.toLowerCase(); return lowerS.split('p').length === lowerS.split('y').length; // 2. match 이용 return s.match(/p/gi)?.length === s.match(/y/gi)?.length; }