You are playing the Bulls and Cows game with your friend. You write down a secret number and ask your friend to guess what the number is. When your friend makes a guess, you provide a hint with the following info:
Bulls: Digits in the guess that are in the correct position
Cows: Digits in the guess that are in your secret number but are located in the wrong position (specifically, the non-bull digits in the guess that could be rearranged to become bulls)
Given the secret number and your friend's guess, return the hint for your friend's guess.
The hint should be formatted as "xAyB", where x is the number of bulls and y is the number of cows.
Note: Both secret and guess may contain duplicate digits.
Input & Output
Constraints
- 1 ≤ secret.length, guess.length ≤ 1000
- secret.length == guess.length
- secret and guess consist of digits only.