<awangdev>299. Bulls and Cows_1.java
public String getHint(String secret, String guess) {
        if (secret == null || guess == null || secret.length() == 0 || guess.length() == 0) {
            return "0A0B";
        }
        
        int[] nums = new int[10]; 
        int bulls = 0, cows = 0;

        for (int i = 0; i < secret.length(); i++) {
            int s = Character.getNumericValue(secret.charAt(i));
            int g = Character.getNumericValue(guess.charAt(i));
            if (s == g) {
                bulls++;
            } else {
                if (nums[s] < 0) cows++;
                if (nums[g] > 0) cows++;
                nums[s]++;
                nums[g]--;
            }
        }

        return String.format("%sA%sB", bulls, cows);
    }
public String var_0 ( String var_2 , String var_3 ) {
  if ( var_2 == null || var_3 == null || var_2 . length ( ) == 0 || var_3 . length ( ) == 0 ) {
    return "0A0B" ;
  }
  int [ ] var_9 = new int [ 10 ] ;
  int var_10 = 0 , var_11 = 0 ;
  for ( int var_12 = 0 ;
  var_12 < var_2 . length ( ) ;
  var_12 ++ ) {
    int var_16 = Character . getNumericValue ( var_2 . charAt ( var_12 ) ) ;
    int var_17 = Character . getNumericValue ( var_3 . charAt ( var_12 ) ) ;
    if ( var_16 == var_17 ) {
      var_10 ++ ;
    }
    else {
      if ( var_9 [ var_16 ] < 0 ) var_11 ++ ;
      if ( var_9 [ var_17 ] > 0 ) var_11 ++ ;
      var_9 [ var_16 ] ++ ;
      var_9 [ var_17 ] -- ;
    }
  }
  return String . format ( "%sA%sB" , var_10 , var_11 ) ;
}
