내 답안
class Solution {
public String[] solution(String my_string) {
String[] answer = my_string.trim().split("\\s+");
return answer;
}
}
Java
복사
다른사람 풀이
import java.util.*;
class Solution {
public String[] solution(String my_string) {
StringTokenizer st = new StringTokenizer(my_string);
int N = st.countTokens();
String[] result = new String[N];
for (int n = 0;n < N;n++)
result[n] = st.nextToken();
return result;
}
}
Java
복사