comefrom: <awangdev>Word Ladder_2.java
code: public int ladderLength(String start, String end, Set<String> dict) {
      	if (start == null || end == null || dict == null || start.length() != end.length()) {
      		return 0;
      	}
      	Queue<String> q = new LinkedList<String>();
      	HashSet<String> set = new HashSet<String>();
      	int level = 1;
      	int len = Integer.MAX_VALUE;
      	q.offer(start);
      	set.add(start);
      	while(!q.isEmpty()) {
      		int size = q.size();
      		level++;
      		for (int k = 0; k < size; k++) {
  	    		String str = q.poll();
  	    		for (int i = 0; i < str.length(); i++) {
  	    			for (int j = 0; j < 26; j++) {
  	    				String newStr;
  	    				if (i == 0 && str.length() == 1) {
  	    				    newStr = "" + (char)('a' + j);
  	    				}
  	    				else if (i == str.length() - 1) {
  	    					newStr = str.substring(0, i) + (char)('a' + j);
  	    				} else {
  	 						newStr = str.substring(0, i) + (char)('a' + j) + str.substring(i + 1);
  	    				}
  	    				if (!set.contains(newStr) && dict.contains(newStr)) {
  	    					if (newStr.equals(end)) {
  	    						len = Math.min(len, level);
  	    					} else {
  	    						set.add(newStr);
  	    						q.offer(newStr);
  	    					}
  	    				}
  	    			}
  	    		}
  	    	}
      	}
      	return len;
      }
masked: public int sample_funcname ( String var_0 , String var_1 , Set < String > var_2 ) {
    if ( var_0 == null || var_1 == null || var_2 == null || var_0 . length ( ) != var_1 . length ( ) ) {
      return 0 ;
    }
    Queue < String > var_3 = new LinkedList < String > ( ) ;
    HashSet < String > var_4 = new HashSet < String > ( ) ;
    int var_5 = 1 ;
    int var_6 = Integer . MAX_VALUE ;
    var_3 . offer ( var_0 ) ;
    var_4 . add ( var_0 ) ;
    while ( ! var_3 . isEmpty ( ) ) {
      int size = var_3 . size ( ) ;
      var_5 ++ ;
      for ( int var_7 = 0 ;
      var_7 < size ;
      var_7 ++ ) {
        String var_8 = var_3 . poll ( ) ;
        for ( int var_9 = 0 ;
        var_9 < var_8 . length ( ) ;
        var_9 ++ ) {
          for ( int var_10 = 0 ;
          var_10 < 26 ;
          var_10 ++ ) {
            String var_11 ;
            if ( var_9 == 0 && var_8 . length ( ) == 1 ) {
              var_11 = "" + ( char ) ( 'a' + var_10 ) ;
            }
            else if ( var_9 == var_8 . length ( ) - 1 ) {
              var_11 = var_8 . substring ( 0 , var_9 ) + ( char ) ( 'a' + var_10 ) ;
            }
            else {
              var_11 = var_8 . substring ( 0 , var_9 ) + ( char ) ( 'a' + var_10 ) + var_8 . substring ( var_9 + 1 ) ;
            }
            if ( ! var_4 . contains ( var_11 ) && var_2 . contains ( var_11 ) ) {
              if ( var_11 . equals ( var_1 ) ) {
                var_6 = Math . min ( var_6 , var_5 ) ;
              }
              else {
                var_4 . add ( var_11 ) ;
                var_3 . offer ( var_11 ) ;
              }
            }
          }
        }
      }
    }
    return var_6 ;
  }
  