Coding Test/프로그래머스
[프로그래머스/자바] 숫자 문자열과 영단어
yurison
2023. 3. 13. 18:14
class Solution {
public int solution(String s) {
String[] words = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
for(int i = 0; i < words.length; i++){
s = s.replace(words[i], Integer.toString(i));
}
return Integer.parseInt(s);
}
}