public class Solution {
public String getHint(String secret, String guess) {
int[] vector = new int[10];
int len = secret.length();
int cntA = 0;
int cntB = 0;
for(int i = 0; i < len; i++) {
char s = secret.charAt(i);
char g = guess.charAt(i);
if (s == g) {
cntA++;
} else {
if(vector[s - '0']++ < 0) cntB++;
if(vector[g - '0']-- > 0) cntB++;
}
}
return cntA + "A" + cntB + "B";
}
}