From f17ece563648d22a212c9b35f213693165824ef3 Mon Sep 17 00:00:00 2001 From: rl544 <111494264+rl544@users.noreply.github.com> Date: Sun, 18 Dec 2022 01:29:40 +0900 Subject: [PATCH] =?UTF-8?q?uploaded=20at=202022.=2012.=2018.=20=EC=98=A4?= =?UTF-8?q?=EC=A0=84=201:29:39?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- programmers/옹알이 (1)/solution.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 programmers/옹알이 (1)/solution.java diff --git a/programmers/옹알이 (1)/solution.java b/programmers/옹알이 (1)/solution.java new file mode 100644 index 0000000..fbd85fe --- /dev/null +++ b/programmers/옹알이 (1)/solution.java @@ -0,0 +1,21 @@ +// [문제 링크]: https://school.programmers.co.kr/learn/courses/30/lessons/120956# + +import java.util.*; +import java.util.stream.IntStream; +class Solution { + public int solution(String[] babbling) { + int answer = 0; + String[] able = {"aya","ye","woo","ma"}; + int[] ablei = {2,3,4,5,6,7,8,10}; + for(String b : babbling){ + int blen = b.length(); + if(IntStream.of(ablei).anyMatch(x -> x == blen)){ + for(String c : able){ + b = b.replaceFirst(c,"1"); + } + if(b.matches("1+")) answer += 1; + } else continue; + } + return answer; + } +} \ No newline at end of file