Notice
Recent Posts
Recent Comments
Link
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

main

[Java] 옹알이 (1) 본문

Algorithm

[Java] 옹알이 (1)

1984 2022. 11. 7. 01:26
class Solution {
	public int solution(String[] babbling) {
		int answer = 0;
		for (String string : babbling) {
			System.out.println(string);
			string = string.replaceAll("aya", " ");
			string = string.replaceAll("ye", " ");
			string = string.replaceAll("woo", " ");
			string = string.replaceAll("ma", " ");
			string = string.replaceAll(" ", "");

			if (string.length() == 0) {
				answer++;
			}
		}
		return answer;
	}
}
728x90
Comments