Beakjoon&프로그래머스/Java

[프로그래머스/Java] 숨어있는 숫자의 덧셈 (2)

현장 2025. 2. 19. 18:00

-Code

import java.util.Arrays;

class Solution {
    public int solution(String my_string) {
        return Arrays.stream(my_string
                        .replaceAll("[a-zA-Z]", " ")
                        .split(" "))
                        .filter(el -> !el.isEmpty())
                        .mapToInt(Integer::parseInt)
                        .sum();
    }
}