split 을 이용한 x 를 구분
endwith 을 이용한 끝 x 자리 처리 를 통해
쉽게 풀 수 있었다
import java.util.*;
class Solution {
public static List<Integer> solution(String myString) {
String[] str;
str = myString.split("x");
List<Integer> list = new ArrayList<>();
for(int i = 0; i < str.length; i++){
list.add(str[i].length());
}
if(myString.endsWith("x")){
list.add(0);
}
return list;
}
}