This is a game played between two players. Player 1 thinks of a word, Player 2 has to guess that word. Player 2 can make a guess at the word in question, and Player 1 must reply with the number of letters in common. You must write a program that plays the game from Player 2's perspective (ie you have to guess the word).
Your program will emit guesses to its standard output stream, whilst taking in the number of common letters on its standard input. If your program guesses the correct answer then it can expect a response of YES on standard input. If Player 1 is using the word 'BLACK' then the following would be an example of what your program could expect on standard in and out:
STDOUT:GLADE
BLADE
DEAD
LACKY
BLACK
STDIN:
2
3
1
4
YES
After receiving a 'YES' your program should terminated.