

영단어 리스트를 문자열 배열로 저장한 후에 replace() 함수를 이용하여 각 영단어에 맞는 숫자로 변환한다.
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);
}
}
