|
|||
MastermindIn Mastermind, the player has to find a sequence of colored balls of a certain length in the least possible number of attempts. They always guess the entire ball sequence by giving a sequence of colors. After each guess, a feedback is given to them about the number of balls that are correct in both color and position, and the number of balls of a correct color in the wrong position. For example, if the ball sequence to be found is blue-green-red-yellow, and the player guesses the sequence brown-green-blue-yellow, then two balls are correct in color and position, and one is correct in color but not in position. After the guess, this information is shared with the player. The basic game is played with four balls, but there are many variations of the game, which can be obtained by changing the length of the ball sequence. Write a program that reads two strings of the same length from each line of the standard input, each containing only uppercase letters of the English alphabet, up to 100 characters, until end-of-file (EOF): the first contains letters indicating the colors of the sequence to be found, and the second is the player’s guess for this sequence. You may assume that each color is represented by a unique letter. For each line of the input, write two integers to the standard output based on the rules of the Mastermind game: first the number of balls that are correct in both color and position, then the number of balls of a correct color in the wrong position. In each line, the two numbers should be separated by a single space character. Sample Input
Output for Sample Input
Acknowledgement
This work was supported by the construction EFOP-3.4.3-16-2016-00021. The project was supported by the European Union, co-financed by the European Social Fund.
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |