class Solution {
public List
<String> stringMatching(String
[] words
) {
List
<String> res
= new ArrayList<>();
if(null
== words
)
return res
;
String str
= String
.join("-",words
);
for(String word
: words
) {
if(str
.indexOf(word
) != str
.lastIndexOf(word
)) {
res
.add(word
);
}
}
return res
;
}
}
转载请注明原文地址:https://blackberry.8miu.com/read-14080.html