<awangdev>Word Pattern_2.java
public boolean wordPattern(String pattern, String str) {
        if (pattern != null && str != null && pattern.length() == 0 && str.length() == 0) {
	        return true;
	    }
	    if (pattern == null || pattern.length() == 0 || str == null || str.length() == 0) {
	        return false;
	    } 
	    String[] strArr = str.split(" ");
	    if (pattern.length() != strArr.length) {
	        return false;
	    }
	    
	    HashMap<Character, String> map = new HashMap<Character, String>();
	    HashMap<String, Character> mapStr = new HashMap<String, Character>();
	    
	    for (int i = 0; i < strArr.length; i++){
	        if (!map.containsKey(pattern.charAt(i))) {
	            map.put(pattern.charAt(i), strArr[i]);
	        } else {
	            if (!map.get(pattern.charAt(i)).equals(strArr[i])) {
	                return false;
	            }
	        }    
	        if (!mapStr.containsKey(strArr[i])) {
	            mapStr.put(strArr[i], pattern.charAt(i));
	        } else {
	            if (mapStr.get(strArr[i]) != pattern.charAt(i)) {
	                return false;
	            }
	        }  
	    } 
	    return true;
    }
public boolean var_0 ( String var_2 , String var_3 ) {
  if ( var_2 != null && var_3 != null && var_2 . length ( ) == 0 && var_3 . length ( ) == 0 ) {
    return true ;
  }
  if ( var_2 == null || var_2 . length ( ) == 0 || var_3 == null || var_3 . length ( ) == 0 ) {
    return false ;
  }
  String [ ] var_9 = var_3 . split ( " " ) ;
  if ( var_2 . length ( ) != var_9 . length ) {
    return false ;
  }
  HashMap < Character , String > var_12 = new HashMap < Character , String > ( ) ;
  HashMap < String , Character > var_13 = new HashMap < String , Character > ( ) ;
  for ( int var_14 = 0 ;
  var_14 < var_9 . length ;
  var_14 ++ ) {
    if ( ! var_12 . containsKey ( var_2 . charAt ( var_14 ) ) ) {
      var_12 . put ( var_2 . charAt ( var_14 ) , var_9 [ var_14 ] ) ;
    }
    else {
      if ( ! var_12 . get ( var_2 . charAt ( var_14 ) ) . equals ( var_9 [ var_14 ] ) ) {
        return false ;
      }
    }
    if ( ! var_13 . containsKey ( var_9 [ var_14 ] ) ) {
      var_13 . put ( var_9 [ var_14 ] , var_2 . charAt ( var_14 ) ) ;
    }
    else {
      if ( var_13 . get ( var_9 [ var_14 ] ) != var_2 . charAt ( var_14 ) ) {
        return false ;
      }
    }
  }
  return true ;
}
