469. Bulls and Cows
MediumCounting
Bulls are digits in the right position; cows are digits present in the secret but in the wrong position (each secret digit counts once). Print the hint as xAyB.
Input format
Line 1: secret Line 2: guess (same length)
Output format
xAyB
Example 1
Input
1807 7810
Output
1A3B
Example 2
Input
1123 0111
Output
1A1B
Constraints
1 ≤ length ≤ 1000
Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.
Loading the MyLoginn IDE…