function solution7(s) {
let temp1 = [];
let temp2 = [];
for (let i = 0; i < s.length; i++) {
if (s[i] === "P" || s[i] === "p") {
temp1 += s[i];
}
if (s[i] === "Y" || s[i] === "y") {
temp2 += s[i];
}
}
if (temp1.length === temp2.length) {
return true;
} else if (temp1.length !== temp2.length) {
return false;
} else {
return true;
}
}
console.log(solution7("pPoooyY"));
console.log(solution7("Pyy"));
console.log(solution7("pypypypypypp"));