# 2019 IUSB Programming Competition # Round 1 Problem 5 # Give the hints for a Mastermind game # Solution by Dana Vrajitoru # Uses Python 3.6.2 import string # inputs the data def inputData(c, g): print("Enter the code and the guess:") str = input() for n in str.split(" "): c.append(int(n)) str = input() for n in str.split(" "): g.append(int(n)) # Counts the exact matches between the two arrays def exactMatches(code, guess): count = 0 for i in range(len(code)): if code[i] == guess[i]: count += 1 return count # Counts the matches between the two arrays def matches(code, guess): count = 0 for i in range(len(code)): if code[i] in guess: count += 1 return count # Testing the function if __name__ == '__main__': code = [] guess = [] inputData(code, guess) em = exactMatches(code, guess) print("%d %d" %(em, matches(code, guess)-em))