public String getHint(String secret, String guess) {
        int bull = 0, cow = 0;
        int[] map = new int[10];
        for (int i = 0; i < secret.length(); ++i) {
            char num = secret.charAt(i);
            if (guess.charAt(i) == num) {
                ++bull;
            } else {
                ++map[num - '0'];
            }
        } 
        for (int i = 0; i < guess.length(); ++i) {
            char num = guess.charAt(i);
            if (num != secret.charAt(i) && map[num - '0'] > 0) {
                ++cow;
                --map[num - '0'];
            }
        }
        return bull + "A" + cow + "B";
    }