Problem F
Finding Ts

You have an image, given as a square grid of asterisks (*) and periods (.), and you want to know if it contains a T somewhere.

A letter T has a horizontal bar made of asterisks. The number of asterisks is $L$, where $L \geq 3$ and $L$ is odd. A letter T also has a vertical bar made of asterisks. The top of the vertical bar is directly beneath the middle asterisk of the horizontal bar. The vertical bar also has $L$ asterisks.

If the image has a T, it contains only a single horizontal bar and a single vertical bar (connected as mentioned), and the only asterisks in the image are those belonging to these two bars.


The first line contains $N$, the image size, an integer between $3$ and $20$, inclusive. Then $N$ lines follow, each with $N$ characters, making up the image. Each line contains only asterisks and periods.


The output is Y if the image contains a T; otherwise, it is N.

Sample Input 1 Sample Output 1
Sample Input 2 Sample Output 2

Please log in to submit a solution to this problem

Log in