2
public int wordCount(String[] startWords, String[] targetWords) {3
int n = startWords.length;5
Set<String> set = new HashSet<>();7
// 1. store lexicographically sorted letters of startword in set8
for (String start : startWords) {9
char[] sAr = start.toCharArray();11
set.add(new String(sAr));13
int m = targetWords.length;15
for (int i = 0; i < m; i++) {16
// 2. sort lexicographically letters of targetword and store in new string s17
char[] tAr = targetWords[i].toCharArray();20
String s = String.valueOf(tAr);23
for (int j = 0; j < k; j++) {24
// 3. make a new string by omitting one letter from word and check if it is present in set25
// than increase count value26
String str = s.substring(0, j) + s.substring(j + 1);27
if (set.contains(str)) {