You have a given picture with size $w \times h$. Determine if the given picture has a single "+" shape or not. A "+" shape is described below:

  A "+" shape has one center nonempty cell.  There should be some (at least one) consecutive non-empty cells in each direction (left, right, up, down) from the center. In other words, there should be a ray in each direction.  All other cells are empty. 

Find out if the given picture has single "+" shape.


-----Input-----

The first line contains two integers $h$ and $w$ ($1 \le h$, $w \le 500$) — the height and width of the picture.

The $i$-th of the next $h$ lines contains string $s_{i}$ of length $w$ consisting "." and "*" where "." denotes the empty space and "*" denotes the non-empty space.


-----Output-----

If the given picture satisfies all conditions, print "YES". Otherwise, print "NO".

You can output each letter in any case (upper or lower).


-----Examples-----
Input
5 6
......
..*...
.****.
..*...
..*...

Output
YES

Input
3 5
..*..
****.
.*...

Output
NO

Input
7 7
.......
...*...
..****.
...*...
...*...
.......
.*.....

Output
NO

Input
5 6
..**..
..**..
******
..**..
..**..

Output
NO

Input
3 7
.*...*.
***.***
.*...*.

Output
NO

Input
5 10
..........
..*.......
.*.******.
..*.......
..........

Output
NO



-----Note-----

In the first example, the given picture contains one "+".

In the second example, two vertical branches are located in a different column.

In the third example, there is a dot outside of the shape.

In the fourth example, the width of the two vertical branches is $2$.

In the fifth example, there are two shapes.

In the sixth example, there is an empty space inside of the shape.

Difficulty: interview

Starter code:

Solutions:
h,w = map(int,input().split())
s = [list(input()) for i in range(h)]
hh = -1
tmp = -1
for k,i in enumerate(s):
    a = i.count('*')
    if tmp < a:
        tmp = a
        hh = k

t = [list(i) for i in list(zip(*s))]
ww = -1
tmp = -1
for k,i in enumerate(t):
    a = i.count('*')
    if tmp < a:
        tmp = a
        ww = k

if s[hh][ww] != '*':
    print('NO')
    return

if hh in (0, h - 1) or ww in (0, w - 1):
    print('NO')
    return

if '.' in (s[hh-1][ww], s[hh+1][ww], s[hh][ww-1], s[hh][ww+1]):
    print('NO')
    return

cnt = 1
for i in range(hh - 1, -1, -1):
    if s[i][ww] == '.':
        break
    cnt += 1
for i in range(ww - 1, -1, -1):
    if s[hh][i] == '.':
        break
    cnt += 1
for i in range(hh + 1, h):
    if s[i][ww] == '.':
        break
    cnt += 1
for i in range(ww + 1, w):
    if s[hh][i] == '.':
        break
    cnt += 1

for i in range(h):
    for j in range(w):
        cnt -= (s[i][j] == '*')

if cnt != 0:
    print('NO')
else:
    print('YES')

n, m = map(int, input().split())
a = [[i == '*' for i in input()] for j in range(n)]
t = ()
for i in range(1, n - 1):
    for j in range(1, m - 1):
        if a[i][j] and a[i][j + 1] and a[i][j - 1] and a[i + 1][j] and a[i - 1][j]:
            if not t:
                t = (i, j)
            else:
                print('NO')
                return
if not t:
    print('NO')
    return
for i in range(t[0], -1, -1):
    if a[i][t[1]]:
        a[i][t[1]] = False
    else:
        break
for i in range(t[0] + 1, n):
    if a[i][t[1]]:
        a[i][t[1]] = False
    else:
        break
for i in range(t[1] - 1, -1, -1):
    if a[t[0]][i]:
        a[t[0]][i] = False
    else:
        break
for i in range(t[1] + 1, m):
    if a[t[0]][i]:
        a[t[0]][i] = False
    else:
        break
# print(a)
for el in a:
    for ell in el:
        if ell:
            print('NO')
            return
print('YES')

r, c = map(int, input().split())
board = [input() for i in range(r)]
stars = sum([i.count('*') for i in board])

def valid(x, y):
  nonlocal r, c
  return 0<=x<r and 0<=y<c 

def f(r, c):
  nonlocal board
  cnt = 1

  for dr, dc in (1, 0), (-1, 0), (0, 1), (0, -1):
    i = 1
    while valid(r + i*dr, c + i*dc):
      if board[r+i*dr][c+i*dc] == '*':
        cnt += 1
      else:
        break
      i += 1
  
  return cnt

for i in range(1, r-1):
  for j in range(1, c-1):
    if '*' == board[i][j] == board[i-1][j] == board[i+1][j] == board[i][j-1] == board[i][j+1]:
      if f(i, j) == stars:
        print("YES")
        return

print("NO")

h, w = map(int, input().split())
T = [[] for i in range(h)]
num = 0
for i in range(h):
    T[i] = list(input())
    for j in range(w):
        if T[i][j] == '*':
            num += 1
if num >= h + w:
    print('NO')
    return
for i in range(h):
    for j in range(w):
        if T[i][j] == '*':
            tmp = 1
            x, y = i, j
            for dx, dy in [(0, 1), (1, 0), (-1, 0), (0, -1)]:
                nx, ny = x + dx, y + dy
                if not (0 <= nx < h and 0 <= ny < w and T[nx][ny] == '*'):
                    tmp = -1000000
                    break
                while 0 <= nx < h and 0 <= ny < w and T[nx][ny] == '*':
                    tmp += 1
                    nx, ny = nx + dx, ny + dy

            if tmp == num:
                print('YES')
                return

print('NO')

def solve():
    H, W = map(int, input().split())
    
    G = [[1 if s == '*' else 0 for s in input()] for _ in range(H)]
    
    h = -1
    cnt = 0
    for i, g in enumerate(G):
        cnt += sum(g)
        if sum(g) > 1:
            if h == -1:
                h = i
            else:
                return False
    
    G = list(map(list, zip(*G)))
    w = -1
    for i, g in enumerate(G):
        if sum(g) > 1:
            if w == -1:
                w = i
            else:
                return False
    
    G = list(map(list, zip(*G)))
    
    c, c1, c2, c3, c4 = 1, 0, 0, 0, 0
    for i in range(w+1, W):
        if not G[h][i]:
            break
        c1 += 1
    for i in range(w-1, -1, -1):
        if not G[h][i]:
            break
        c2 += 1
    for i in range(h+1, H):
        if not G[i][w]:
            break
        c3 += 1
    for i in range(h-1, -1, -1):
        if not G[i][w]:
            break
        c4 += 1
    c += c1 +c2 + c3 + c4
    if c == cnt and c1*c2*c3*c4:
        return True
    return False

if solve():
    print('YES')
else:
    print('NO')

h,w=map(int,input().split())
arr=[]
for i in range(h):
	s=str(input())
	arr1=[]
	for j in range(w):
		arr1.append(s[j])
	arr.append(arr1)
flag=0
h1=-1
w1=-1
for i in range(1,h-1):
	for j in range(1,w-1):
		if(arr[i][j]=='*'):
			if(arr[i-1][j]==arr[i+1][j]==arr[i][j-1]==arr[i][j+1]=='*'):
				flag=1
				h1=i
				w1=j
				break
	if(flag==1):
		break
if(flag==1):
	i=h1
	while(i>=0 and arr[i][w1]=='*'):
		arr[i][w1]='?'
		i-=1

	i=h1+1
	while(i<h and arr[i][w1]=='*'):
		arr[i][w1]='?'
		i+=1

	j=w1-1
	while(j>=0 and arr[h1][j]=='*'):
		arr[h1][j]='?'
		j-=1
	j=w1+1
	while(j<w and arr[h1][j]=='*'):
		arr[h1][j]='?'
		j+=1

	# for i in range(h):
	# 	print(*arr[i])

	flag2=0
	for i in range(h):
		for j in range(w):
			if(arr[i][j]=='*'):
				flag2=1
				break
		if(flag2==1):
			break

	if(flag2==0):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


def main():
    buf = input()
    buflist = buf.split()
    h = int(buflist[0])
    w = int(buflist[1])
    S = []
    for i in range(h):
        buf = input()
        S.append(buf)
    cross_point = []
    for i in range(h):
        cross_point.append([])
        for j in range(w):
            if i > 0 and i < h-1 and j > 0 and j < w-1:
                if S[i][j] == '*' and S[i-1][j] == '*' and S[i+1][j] == '*' and S[i][j-1] == '*' and S[i][j+1] == '*':
                    cross_point[i].append(True)
                    continue
            cross_point[i].append(False)
    cross_point_location = None
    for i in range(h):
        for j in range(w):
            if cross_point[i][j]:
                if cross_point_location == None:
                    cross_point_location = (i, j)
                else:
                    print('NO') # multiple crosses
                    return
    if cross_point_location == None:
        print('NO') # no crosses
        return
    group = []
    for i in range(h):
        group.append([])
        for j in range(w):
            group[i].append(False)
    # down
    for i in range(cross_point_location[0], h):
        if S[i][cross_point_location[1]] == '*':
            group[i][cross_point_location[1]] = True
        else:
            break
    # up
    for i in range(cross_point_location[0], -1, -1):
        if S[i][cross_point_location[1]] == '*':
            group[i][cross_point_location[1]] = True
        else:
            break
    # right
    for j in range(cross_point_location[1], w):
        if S[cross_point_location[0]][j] == '*':
            group[cross_point_location[0]][j] = True
        else:
            break
    # left
    for j in range(cross_point_location[1], -1, -1):
        if S[cross_point_location[0]][j] == '*':
            group[cross_point_location[0]][j] = True
        else:
            break
    for i in range(h):
        for j in range(w):
            if S[i][j] == '*' and not group[i][j]:
                print('NO') # others are not empty
                return
    print('YES')


def __starting_point():
    main()

__starting_point()

import sys
input = sys.stdin.readline

h,w=list(map(int,input().split()))
MAP=[list(input()) for i in range(h)]
flag=0

for i in range(1,h-1):
    for j in range(1,w-1):
        if MAP[i][j]==MAP[i-1][j]==MAP[i+1][j]==MAP[i][j-1]==MAP[i][j+1]=="*":
            CI=i
            CJ=j
            flag=1
            break

    if flag==1:
        break

if flag==0:
    print("NO")
    return

LIST=[[0]*w for i in range(h)]

for i in range(CI,-1,-1):
    if MAP[i][CJ]=="*":
        LIST[i][CJ]=1
    else:
        break

for i in range(CI,h):
    if MAP[i][CJ]=="*":
        LIST[i][CJ]=1
    else:
        break

for j in range(CJ,-1,-1):
    if MAP[CI][j]=="*":
        LIST[CI][j]=1
    else:
        break

for j in range(CJ,w):
    if MAP[CI][j]=="*":
        LIST[CI][j]=1
    else:
        break

#print(LIST)

for i in range(h):
    for j in range(w):
        if MAP[i][j]=="*" and LIST[i][j]==0:
            print("NO")
            return

print("YES")


import sys

n, m = map(int, input().split())

grid = []

stars = []

for r in range(n):
	grid.append([])
	for c in range(m):
		if sys.stdin.read(1) == "*":
			stars.append((r, c))
			grid[-1].append(1)
		else:
			grid[-1].append(0)
	sys.stdin.read(1)

rc = {}
cc = {}

for r, c in stars:
	rc[r] = rc.get(r, 0) + 1
	cc[c] = cc.get(c, 0) + 1

if len(rc) != 1 + list(rc.values()).count(1):
	print("NO")
elif len(cc) != 1 + list(cc.values()).count(1):
	print("NO")
else:
	x = [i for i in rc if rc[i] > 1][0]
	y = [i for i in cc if cc[i] > 1][0]
	center = (x, y)
	try:
		if not (grid[x - 1][y] and grid[x + 1][y] and grid[x][y - 1] and grid[x][y + 1]):
			print("NO")
		else:
			count = 0
			for delta in [(0, 1), (1, 0), (0, -1), (-1, 0)]:
				cx, cy = center
				while 0 <= cx < n and 0 <= cy < m and grid[cx][cy]:
					cx, cy = cx + delta[0], cy + delta[1]
					count += 1
			if len(stars) == count - 3:
				print("YES")
			else:
				print("NO")
	except:
		print("NO")

def gns():
    return list(map(int,input().split()))
r,c=gns()
m=[[0]*c for i in range(r)]
rm,cm=[0]*r,[0]*c
for i in range(r):
    x=input()
    for j in range(c):
        if x[j]=='*':
            m[i][j]=1
            rm[i]+=1
            cm[j]+=1
x,y=0,0
for i in range(r):
    if rm[i]>=3:
        x=i
for j in range(c):
    if cm[j]>=3:
        y=j
ans=1
if (x==0 or x==r-1 or y==0 or y==c-1) or m[x][y]+m[x-1][y]+m[x+1][y]+m[x][y-1]+m[x][y+1]<5:
    print('NO')
    quit()
j=y-1
while j>=0:
    if m[x][j]==1:
        ans+=1
    else:
        break
    j-=1
j=y+1
while j<c:
    if m[x][j]==1:
        ans+=1
    else:
        break
    j+=1
i=x-1
while i>=0:
    if m[i][y]==1:
        ans+=1
    else:
        break
    i-=1
i=x+1
while i<r:
    if m[i][y]==1:
        ans+=1
    else:
        break
    i+=1
if ans==sum(rm):
    print('YES')
else:
    print('NO')


n, m = map(int, input().split())
s = []
for i in range(n):
    s.append(input())

flag = False

def check(x, y):
    if s[x-1][y-1] == s[x-1][y+1] == s[x+1][y-1] == s[x+1][y+1] == '.' and s[x-1][y] == s[x][y] == s[x+1][y] == s[x][y-1] == s[x][y+1] == '*':
        return True
    return False

def supercheck(x, y):
    k = 1
    i = x-1
    while i >= 0 and s[i][y] == '*':
        i -= 1
        k += 1

    i = x+1
    while i < n and s[i][y] == '*':
        i += 1
        k += 1

    i = y - 1
    while i >= 0 and s[x][i] == '*':
        i -= 1
        k += 1

    i = y + 1
    while i < m and s[x][i] == '*':
        i += 1
        k += 1

    true_k = 0
    for i in range(n):
        for j in range(m):
            if s[i][j] == '*':
                true_k += 1

    if true_k == k:
        return True
    return False


for i in range(1, n - 1):
    for j in range(1, m - 1):
        if s[i][j] != '*': continue
        if check(i, j):
            if supercheck(i, j):
                print('YES')
                return
            else:
                print('NO')
                return

print('NO')

n,m=map(int,input().split())
a=[]
for i in range(n):
    a.append(list(input()))
b=0
for i in a:
    b+=i.count('*')
x=y=-1
for i in range(1,n-1):
    for j in range(1,m-1):
        if a[i][j]==a[i][j-1]==a[i][j+1]==a[i-1][j]==a[i+1][j]=='*':
            x=i
            y=j
            break
if x==y==-1:
    print('NO');return
r=1
for i in range(x+1,n):
    if a[i][y]=='*':
        r+=1
    else:
        break
for i in range(x-1,-1,-1):
    if a[i][y]=='*':
        r+=1
    else:
        break
for i in range(y+1,m):
    if a[x][i]=='*':
        r+=1
    else:
        break
for i in range(y-1,-1,-1):
    if a[x][i]=='*':
        r+=1
    else:
        break
if r==b:
    print('YES')
else:
    print('NO')



        

h,w=map(int,input().split())
arr=[input() for _ in range(h)]
cnt_center=0
pos_center_x=0
pos_center_y=0
cnt_plus=1
cnt_black=0
if h>=3 and w>=3:
  for i in range(1,h-1):
    for j in range(1,w-1):
      if arr[i][j]=='*':
        if arr[i-1][j]=='*' and arr[i+1][j]=='*' and arr[i][j-1]=='*' and arr[i][j+1]=='*':
          cnt_center+=1
          pos_center_y=i
          pos_center_x=j
  if cnt_center!=1:
    print('NO')
  else:
    for i in range(pos_center_x-1,-1,-1):
      if arr[pos_center_y][i]=='*':
        cnt_plus+=1
      else:
        break
    for i in range(pos_center_x+1,w):
      if arr[pos_center_y][i]=='*':
        cnt_plus+=1
      else:
        break
    for i in range(pos_center_y-1,-1,-1):
      if arr[i][pos_center_x]=='*':
        cnt_plus+=1
      else:
        break
    for i in range(pos_center_y+1,h):
      if arr[i][pos_center_x]=='*':
        cnt_plus+=1
      else:
        break
    for i in range(h):
      for j in range(w):
        if arr[i][j]=='*':
          cnt_black+=1
    if cnt_plus==cnt_black:
      print('YES')
    else:
      print('NO')
else:
  print('NO')


def __starting_point():
    h, w = list(map(int, input().split()))
    s = []
    for _ in range(h):
        s.append(list(input()))

    rr, cc = None, None

    for r in range(1, h-1):
        for c in range(1, w - 1):
            if s[r][c] == s[r-1][c] == s[r][c-1] == s[r+1][c] == s[r][c+1] == '*':
                s[r][c] = '.'

                i = r + 1
                while i < h and s[i][c] == '*':
                    s[i][c] = '.'
                    i += 1

                i = r - 1
                while i >= 0 and s[i][c] == '*':
                    s[i][c] = '.'
                    i -= 1

                i = c + 1
                while i < w and s[r][i] == '*':
                    s[r][i] = '.'
                    i += 1

                i = c - 1
                while i >= 0 and s[r][i] == '*':
                    s[r][i] = '.'
                    i -= 1

                for i in range(h):
                    for j in range(w):
                        if s[i][j] == '*':
                            print("NO")
                            return

                print("YES")
                return

    print("NO")



__starting_point()

n, m = list(map(int, input().split()))
arr = []
for i in range(n):
  arr.append(input())

seen = set()

def get_first_star():
  r, c = -1, -1
  for i in range(n):
    for j in range(m):
      if arr[i][j] == '*':
        seen.add((i, j))
        return i, j
  return r, c

def vertical_points(r, c):
  i = r+1
  while i < n and arr[i][c] == '*':
    seen.add((i, c))
    i += 1
  return i

def find_horizontal(r, re, c):
  i = r+1
  found = False
  while i < re-1:
    if arr[i][c-1] == '*' and arr[i][c+1] == '*':
      found = True
      break
    i += 1
  if not found:
    return -1
  j = c-1
  while j >= 0 and arr[i][j] == '*':
    seen.add((i, j))
    j -= 1
  j = c+1
  while j < m and arr[i][j] == '*':
    seen.add((i, j))
    j += 1
  return 1

def find_answer():
  r, c = get_first_star()
  if c <=0 or c >= m-1:
    return -1

  re = vertical_points(r, c) 
  res = find_horizontal(r, re, c) 
  if res == -1:
    return -1

  for i in range(n):
    for j in range(m):
      if (i, j) not in seen and arr[i][j] == '*':
        return -1

  return 1

print("YES" if find_answer() == 1 else "NO")


def printGrid(grid):
	for row in grid:
		print(' '.join(list(map(str, row))))

n, m = map(int, input().strip().split())
grid = [list(input().strip()) for _ in range(n)]
c = 0
found = False
for i in range(1, n-1):
	if found:	break
	for j in range(1, m-1):
		if grid[i][j] == '*' and grid[i-1][j] == '*' and grid[i+1][j] == '*' and grid[i][j-1] == '*' and grid[i][j+1] == '*':
			grid[i][j] = '.'
			r, c = i-1, j
			while r >= 0:
				if grid[r][c] == '*':
					grid[r][c] = '.'
					r -= 1
				else:
					break
			r, c = i+1, j
			while r < n:
				if grid[r][c] == '*':
					grid[r][c] = '.'
					r += 1
				else:
					break
			r, c = i, j-1
			while c >= 0:
				if grid[r][c] == '*':
					grid[r][c] = '.'
					c -= 1
				else:
					break
			r, c = i, j+1
			while c < m:
				if grid[r][c] == '*':
					grid[r][c] = '.'
					c += 1
				else:
					break
			found = True
			break
if not found:
	print('NO');return
for row in grid:
	if '*' in row:
		print('NO');return
print('YES')

n,m=list(map(int,input().split()))
def parc(pt,j):
    if l[pt[0]][pt[1]]:
        l[pt[0]][pt[1]]=False
        parc(j(pt),j)
def f():
    mv=[lambda x:(x[0]+1,x[1]),lambda x:(x[0]-1,x[1]),lambda x:(x[0],x[1]-1),lambda x:(x[0],x[1]+1)]
    for k in range(2,n):
        for i in range(2,m):
            if l[k][i] and min(l[j[0]][j[1]] for j in [h((k,i)) for h in mv]):
                for j in mv:
                    parc(j((k,i)),j)
                l[k][i]=False
                if max(list(map(max,l))):
                    return False
                return True
    return False

l=[[False]*(m+2)]
for k in range(n):
    l.append([False]+[i=='*' for i in input()]+[False])
l.append([False]*(m+2))
if f():
    print("YES")
else:
    print("NO")


import io, sys, atexit, os
import math as ma
from decimal import Decimal as dec
from itertools import permutations


def li ():
	return list (map (int, input ().split ()))


def num ():
	return map (int, input ().split ())


def nu ():
	return int (input ())


def find_gcd ( x, y ):
	while (y):
		x, y = y, x % y
	return x


def lcm ( x, y ):
	gg = find_gcd (x, y)
	return (x * y // gg)


mm = 1000000007
yp = 0

def solve ():
	t = 1
	for _ in range (t):
		h,w=num()
		xp=[0]*h
		for i in range(h):
			xp[i]=[0]*w
			lp=input()
			for j in range(len(lp)):
				if(lp[j]=="."):
					xp[i][j]=0
				else:
					xp[i][j]=1
		fl=False
		for i in range(h):
			for j in range(w):
				if(xp[i][j]==1):
					if((i-1>=0 and xp[i-1][j]==1) and (i+1<h and xp[i+1][j]==1) and (j-1>=0 and xp[i][j-1]==1) and (j+1<w and xp[i][j+1]==1)):
						fl=True
						xp[i][j]=2
						for k in range(i-1,-1,-1):
							if(xp[k][j]==1):
								xp[k][j]=2
							else:
								break
						for k in range(i+1,h):
							if (xp [ k ] [ j ] == 1):
								xp [ k ] [ j ] = 2
							else:
								break
						for k in range(j-1,-1,-1):
							if (xp [ i ] [ k ] == 1):
								xp [ i ] [ k ] = 2
							else:
								break
						for k in range(j+1,w):
							if (xp [ i ] [ k ] == 1):
								xp [ i ] [ k ] = 2
							else:
								break
						break
			if(fl):
				break
		if(fl):
			op=True
			for i in range(h):
				for j in range(w):
					if(xp[i][j]==1):
						op=False
			if(op==False):
				print("NO")
			else:
				print("YES")
		else:
			print("NO")

def __starting_point():
	solve ()
__starting_point()

n, m = list(map(int, input().split()))
seen = [[False]*m for _ in range(n)]
mat = [input() for _ in range(n)]


def is_cross(i, j):
	if i == 0 or i == n -1 or j == 0 or j == m-1 or mat[i-1][j] != '*' or mat[i+1][j] != '*' or mat[i][j-1] != '*' or mat[i][j+1] != '*':
		return (False, None, None)
	else:
		top = i-1
		bot = i+1
		left = j-1
		right = j+1
		while top > 0 and mat[top-1][j] == '*':
			top -= 1
		while left > 0 and mat[i][left-1] == '*':
			left -= 1
		while bot < n-1 and mat[bot+1][j] == '*':
			bot += 1
		while right < m-1 and mat[i][right+1] == '*':
			right += 1

		return (True, [[top, bot], [left, right]], (i, j))


found = False
for i in range(n):
	for j in range(m):
		if mat[i][j] == '*':
			is_a_cross, sizes, center = is_cross(i, j)
			if is_a_cross:
				found = True
				break
	if found:
		break

answered = False

if found:
	top, bot = sizes[0]
	left, right = sizes[1]
	for i in range(n):
		for j in range(m):
			if mat[i][j] == '*':
				if i == center[0]:
					if j not in list(range(left, right + 1)):
						print('NO')
						answered = True
				elif j == center[1]:
					if i not in list(range(top, bot + 1)):
						print('NO')
						answered = True
				else:
					print('NO')
					answered = True
			if answered:
				break
		if answered:
			break
	if not answered:
		print('YES')

else:
	print('NO')


def main():
    h, w = list(map(int, input().split()))
    matrix = [input() for j in range(h)]
    cnt = 0
    for i in range(h):
        for j in range(w):
            if matrix[i][j] == '*':
                cnt += 1
    if w < 3 or h < 3:
        print("NO")
    else:
        ok = False
        for y in range(1, h - 1):
            for x in range(1, w - 1):
                if matrix[y][x] == '*' and matrix[y + 1][x] == '*' and matrix[y - 1][x] == '*' and matrix[y][x + 1] == '*' and matrix[y][x - 1] == '*':
                    r = ""
                    c = ""
                    for i in range(w):
                        r += matrix[y][i]
                    for i in range(h):
                        c += matrix[i][x]
                    # sooqa blya
                    subbuff = 0
                    left, right = r.find('*'), r.rfind('*')
                    for i in range(left, right + 1):
                        if r[i] != '*':
                            break
                        else:
                            subbuff += 1
                    if subbuff != right - left + 1:
                        ok = False
                        break
                    buff = 0
                    left, right = c.find('*'), c.rfind('*')
                    for i in range(left, right + 1):
                        if c[i] != '*':
                            break
                        else:
                            buff += 1
                    if buff != right - left + 1:
                        ok = False
                        break
                    if subbuff + buff == cnt + 1:
                        ok = True
                    break
        if ok:
            print("YES")
        else:
            print("NO")


main()


def get_int_list():
    return list(map(int, input().split()))

import sys

h, w = tuple(map(int, input().split()))

data = []
for i in range(h):
    data.append(list([[x, False] for x in input()]))

found = False
for i in range(h):
    for j in range(w):
        if not found and data[i][j][0] == "*" and i > 0 and j > 0 and i < h - 1 and j < w - 1:
            if data[i - 1][j][0] == "*" and data[i + 1][j][0] == "*" and \
                data[i][j - 1][0] == "*" and data[i][j + 1][0] == "*":
                found = True
                data[i][j][1] = True
                row = i - 1
                while row >= 0 and data[row][j][0] == "*":
                    data[row][j][1] = True
                    row -= 1
                row = i + 1
                while row < h and data[row][j][0] == "*":
                    data[row][j][1] = True
                    row += 1
                column = j - 1
                while column >= 0 and data[i][column][0] == "*":
                    data[i][column][1] = True
                    column -= 1
                column = j + 1
                while column < w and data[i][column][0] == "*":
                    data[i][column][1] = True
                    column += 1
                    
for i in range(h):
    for j in range(w):
        if data[i][j][0] == "*" and not data[i][j][1]:
            print("NO")
            return
            
print("YES" if found else "NO")
                        
        


H, W = list(map(int, input().split()))
X = [[[0, 1][a=="*"] for a in input()] for i in range(H)]

def main():
    s = sum([sum(x) for x in X])
    # print(X, s)
    
    h, w = -1, -1
    for i in range(H):
        for j in range(W):
            if X[i][j]:
                w = j
                break
        if w >= 0:
            break
    else:
        return 0
    
    for j in range(W):
        for i in range(H):
            if X[i][j]:
                h = i
                break
        if h >= 0:
            break
    else:
        return 0
    
    if X[h][w] == 0:
        return 0
    
    c = 1
    for di, dj in [(0,1),(0,-1),(1,0),(-1,0)]:
        # print(di, dj)
        i, j = h, w
        # print("h, w =", h, w)
        if 0<=i+di<H and 0<=j+dj<W:
            if X[i+di][j+dj] == 0:
                return 0
        else:
            return 0
        
        while 0<=i+di<H and 0<=j+dj<W:
            i += di
            j += dj
            # print("--", i,j)
            if X[i][j] == 0:
                break
            # print("i, j =", i, j)
            c += 1
    # print(s, c)
    if s == c:
        return 1
    return 0
            
if main():
    print("YES")
else:
    print("NO")


h,w=map(int, input().split())
inpL = []
isTrue = False
for z in range(h):
     inpL.append(list(str(input())))
for i in range(1,h-1):
    for j in range(1, w-1):
        if inpL[i][j] == "*":
            if inpL[i+1][j] == "*":
                if inpL[i-1][j] == "*":
                    if inpL[i][j+1] == "*":
                        if inpL[i][j-1] == "*":
                            isTrue = True
                            x = i+0
                            while x >= 0:
                                if inpL[x][j] == "*":
                                    inpL[x][j] = "."
                                else:
                                    break
                                x-=1
                            x = i+1
                            while x < h:
                                if inpL[x][j] == "*":
                                    inpL[x][j] = "."
                                else:
                                    break
                                x+=1
                            y = j-1
                            while y >= 0:
                                if inpL[i][y] == "*":
                                    inpL[i][y] = "."
                                else:
                                    break
                                y-=1
                            y=j+1
                            while y < w:
                                if inpL[i][y] == "*":
                                    inpL[i][y] = "."
                                else:
                                    break
                                y+=1
                            break
    if isTrue:
        break
#print(*inpL)

if isTrue:
    isTrue = True
    for i in range(h):
        if "*" in inpL[i]:
            isTrue=False
            break
    if isTrue:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

m, n = list(map(int, input().split()))
t = [input() for i in range(m)]
c = 0
import sys
for i in range(m):
	if c == 1:
		break
	for j in range(n):
		if c == 1:
			break
		if t[i][j] == "*":
			p = [0] * 4
			p[0] = (i < m - 1 and t[i+1][j] == "*")
			p[1] = (j > 0 and t[i][j-1] == "*")
			p[2] = (i > 0 and t[i-1][j] == "*")
			p[3] = (j < n - 1 and t[i][j+1] == "*")
			if sum(p) == 4:
				c = 1
				r = i
				c = j
if c == 0:
	print("NO")
	return
else:
	i = r
	j = c
	w = 1
	while True:
		if i < m - 1 and t[i+1][j] == "*":
			i += 1
			w += 1
		else:
			break
	i = r
	j = c
	while True:
		if j > 0 and t[i][j-1] == "*":
			j -= 1
			w += 1
		else:
			break
	i = r
	j = c
	while True:
		if i > 0 and t[i-1][j] == "*":
			i -= 1
			w += 1
		else:
			break
	i = r
	j = c
	while True:
		if j < n - 1 and t[i][j+1] == "*":
			j += 1
			w += 1
		else:
			break
	h = 0
	for i in range(m):
		for j in range(n):
			if t[i][j] == "*":
				h += 1
if h != w:
	print("NO")
	return
print("YES")