class Solution {
boolean solution(String s) {
boolean answer = true;
int result = 0;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == 'p' || c == 'P') result++;
if (c == 'y' || c == 'Y') result--;
}
if (result != 0) answer = false;
return answer;
}
}
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges