<awangdev>245. Shortest Word Distance III_1.java
public int shortestWordDistance(String[] words, String word1, String word2) {
        Integer p1 = null, p2 = null;
        int distance = Integer.MAX_VALUE;
        for (int i = 0; i < words.length; i++) {
            String word = words[i];
            
            if (word.equals(word1) && word.equals(word2)) { 
                if (p1 != null) distance = Math.min(distance, i - p1); 
                p1 = i; 
                continue;
            }
            if (words[i].equals(word1)) p1 = i;
            if (words[i].equals(word2)) p2 = i;
            if (p1 != null && p2 != null) distance = Math.min(distance, Math.abs(p1 - p2));
        }
        return distance;
    }
public int sample_funcname ( String [ ] var_1 , String var_2 , String var_3 ) {
  Integer var_6 = null , var_7 = null ;
  int var_9 = Integer . MAX_VALUE ;
  for ( int var_11 = 0 ;
  var_11 < var_1 . length ;
  var_11 ++ ) {
    String var_13 = var_1 [ var_11 ] ;
    if ( var_13 . equals ( var_2 ) && var_13 . equals ( var_3 ) ) {
      if ( var_6 != null ) var_9 = Math . min ( var_9 , var_11 - var_6 ) ;
      var_6 = var_11 ;
      continue ;
    }
    if ( var_1 [ var_11 ] . equals ( var_2 ) ) var_6 = var_11 ;
    if ( var_1 [ var_11 ] . equals ( var_3 ) ) var_7 = var_11 ;
    if ( var_6 != null && var_7 != null ) var_9 = Math . min ( var_9 , Math . abs ( var_6 - var_7 ) ) ;
  }
  return var_9 ;
}
