Crosswords |
This problem deals with crosswords, as they are known from every newspaper. A cross- word is words arranged horizontally and vertically in a rectangle. Two words can share one character where they are crossing. The problem is to decide whether the crossword is solved correctly or not.
Input file contains any number of lines of the format: word x y d. word, x, y and d are in standard text format. x and y mean the coordinate of the starting point of the word and d is the direction in which the word is written. The coordinate system starts at the upper left of the rectangle with the coordinates (1,1). The direction is given by a single character where u means upwards, r means right, d means down and l means left.
These lines are follwed by a blank line, and then the file contains the ``solution" in the following format: The first line is the width of the crossword, and the second line is the higth. The third line is all the characters of the crossword listed from left to right, from top to bottom.
The output must be one of the following sentences:
or
The inputfile cross1.inp:
second 1 1 r vis 1 3 r file 2 4 u castle 3 1 d end 6 3 u 6 6 second la nvis e ft l e <eof>
The crossword is correct.