P1101 Word Grid
Description
Given an $n \times n$ letter grid, there may be multiple occurrences of the word `yizhong`. Each word is placed contiguously along a single direction. Placement can be along any of the $8$ directions, and the direction does not change within the same word. Different words may cross and share letters. In the output, replace letters that are not part of any occurrence of the word with `*` to highlight the words.
Input Format
- The first line contains an integer $n$ ($7 \le n \le 100$).
- Starting from the second line, input the $n \times n$ letter matrix.
Output Format
Output the $n \times n$ matrix where letters not belonging to any `yizhong` are replaced by `*`.
Explanation/Hint
Translated by ChatGPT 5