secret game


Submit solution

Points: 10 (partial)
Time limit: 6.0s
Memory limit: 12M

Authors:
Problem type
Allowed languages
C++

Secret Guess game

This is an old game for two players, often played with paper and pen.

The first player, let it be A - chooses a secret 4-digit code (like 1492), with all digits different.

The second player, let it be B - makes a single attempt to guess this code. She can offer any combinations of 4 digits (without repetitions) –

Finally, player A should give the hint.

The hint consists of two values: (first value – Second value):

The first value tells how many digits are guessed correctly and are in the correct positions;

The second value tells how many digits are guessed correctly but are in the wrong positions.

For example, if the secret value is 1492 and B guess is 2013 - A should answer with 0-2.

And if the guess is 1865, then the hint would be 1-0.

Input format:

The first value of the input represents the secret value, second value represents the guess value.

Sample Input:

1492

2013

Sample Output:

The hint is : 0-2

Note: [ Explanation: the first value of hint is 0, because the no of digits are guessed correctly and are in the correct positions is 0, Second value of hint is : 2, because, In the guessed number there are two digits say digit 1 and 2 are guessed correctly but are in wrong positions. ]


Comments


  • -3
    CBENU4CSE22426  commented on May 16, 2023, 10:02 a.m.

    include<stdio.h>

    int main() {

    }