1class Solution {2public List<String> stringMatching(String[] words) {3List<String> ans = new ArrayList<>();4for (int i = 0; i < words.length; i++) {5String s = words[i];6for (int j = 0; j < words.length; j++) {7if (i == j) {8continue;9}10if (words[j].indexOf(s) >= 0) {11ans.add(s);12break;13}14}15}16return ans;17}18}