You are playing a number-guessing game with your friend.
You write down a secret number, and your friend tries to guess it.
After each guess, you must give feedback in the form of bulls and cows:
⢠A bull š means a digit in the guess is correct and in the right position.
⢠A cow š means a digit is present in the secret number but in the wrong position.
Your task is to calculate and return the result in the format:
"<bulls>A<cows>B",
where:
⢠bulls = count of digits that match in both value and position
⢠cows = count of digits that exist in the secret but in a different position
Both secret and guess may contain duplicate digits.
Input: secret = "4291" guess = "1234"
Output: "1A2B"
Input: secret = "5568" guess = "6555"
Output: "1A2B"
Accepted:
Submission: