Print to the file ManoKnyga.txt a merged text, composed according to the following rules:
Text from the first file is copied until the first non-copied word from the second file is encountered, or the end of the file is reached;
Text from the second file is copied until the first non-copied word from the first file is encountered, or the end of the file is reached;
This is repeated until the end of both files is reached.
The issue I'm facing with the code I have is that the method does not output the correct results. It has to check each word from each file simultaneously line by line to see check wether the word in one file matches another, if it does then the code has to be appended from the 2nd file and vice versa, until the end of both files is reached.