static int minimumDistance(String[] wordArray, String word1, String word2){
int minDistance = Integer.MAX_VALUE;
if(word1 != null && word2 != null){
int index1 = -1;
int index2 = -1;
for(int i=0; i<wordArray.length; i++){
if(word1.equals(wordArray[i]))
index1 = i;
if(word2.equals(wordArray[i]))
index2 = i;
if(index1 != -1 && index2 != -1){
int dist = Math.abs(index1 - index2);
minDistance = Math.min(dist, minDistance);
}
}
}
return minDistance;
}