```
int bulls = 0;
int cows = 0;
int[] numbers = new int[10];
for (int i = 0; i<secret.length(); i++) {
if (secret.charAt(i) == guess.charAt(i)){
bulls++;
}
else {
numbers[secret.charAt(i) - '0'] ++;
}
}
for (int i = 0; i<secret.length(); i++) {
if (secret.charAt(i) != guess.charAt(i) && numbers[guess.charAt(i) - '0'] > 0) {
cows++;
numbers[guess.charAt(i) - '0']--;
}
}
return bulls + "A" + cows + "B";
```