Problem:
 Score : 200 points    Problem Statement There is a grid of squares with H horizontal rows and W vertical columns.
The square at the i -th row from the top and the j -th column from the left is represented as (i, j) .
Each square is black or white.
The color of the square is given as an H -by- W matrix (a_{i, j}) .
If a_{i, j} is . , the square (i, j) is white; if a_{i, j} is # , the square (i, j) is black.  Snuke is compressing this grid.
He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:   Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.   It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.
Find the final state of the grid.      Constraints  1 \leq H, W \leq 100  a_{i, j} is . or # .  There is at least one black square in the whole grid.         Input Input is given from Standard Input in the following format:  H  W  a_{1, 1}...a_{1, W}  :  a_{H, 1}...a_{H, W}       Output Print the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.        Sample Input 1 4 4
##.#
....
##.#
.#.#      Sample Output 1 ###
###
.##  The second row and the third column in the original grid will be removed.       Sample Input 2 3 3
#..
.#.
..#      Sample Output 2 #..
.#.
..#  As there is no row or column that consists only of white squares, no operation will be performed.       Sample Input 3 4 5
.....
.....
..#..
.....      Sample Output 3 #       Sample Input 4 7 6
......
....#.
.#....
..#...
..#...
......
.#..#.      Sample Output 4 ..#
#..
.#.
.#.
#.#

Solution (Python):
h,w = map(int, input().split())
a = [''] * h
for i in range(h):
    a[i] = input()

row = [False] * h
col = [False] * w
for i in range(h):
    for j in range(w):
        if a[i][j] == '
            row[i] = True
            col[j] = True

for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j], end = '')
        print()

Solution (Python):
h, w = map(int, input().split())
t = []
goodx = [0]*110
goody = [0]*110

for i in range(h):
    t.append(input())

for i in range(h):
    for j in range(w):
        if t[i][j] == "
            goodx[i] = 1
            goody[j] = 1

for i in range(h):
    if goodx[i]:
        for j in range(w):
            if goody[j]:
                print(t[i][j], end="")
        print()

Solution (Python):
import numpy as np

H,W = map(int, input().split())

arr = np.zeros((H,W), dtype=np.object)

for h in range(H):
  chars = input()
  for w in range(W):
    
    arr[h, w] = chars[w]
h_replace = []
for h in range(H):
  if all([a == '.' for a in arr[h]]):
    h_replace.append( h )

w_replace = []
for w in range(W):
  if all([a == '.' for a in arr[:,w]]):
    w_replace.append( w )

arr = np.delete(arr, h_replace, axis=0)
arr = np.delete(arr, w_replace, axis=1)
[ print(''.join(ar)) for ar in arr.tolist() ]

Solution (Python):
h,w=map(int,input().split())
a=[]
for i in range(h):
    j=list(input())
    if '
        a.append(j)
aa=zip(*[i for i in zip(*a) if '
for i in aa:
    print(''.join(i))

Solution (Python):
h,w=map(int,input().split())
a=[]
for i in range(h):
    j=list(input())
    if '
        a.append(j)
aa=zip(*[i for i in zip(*a) if '
for i in aa:
    print(*i,sep='')

Solution (Python):
import numpy as np
import sys

H, W = map(int, raw_input().split())
a = []
for i in range(H):
	_a = list(raw_input())
	a.append(_a)
a = np.array(a)

row_exist = [False] * H
col_exist = [False] * W
for i in range(H):
	if '
		row_exist[i] = True
for i in range(W):
	if '
		col_exist[i] = True
for i in range(H):
	for j in range(W):
		if row_exist[i] and col_exist[j]:
			sys.stdout.write(a[i, j])
	if row_exist[i]:
		print ""

Solution (Python):
h,w = map(int, input().split())
a = [input() for i in range(h)]
row = [0]*h
col = [0]*w
for i in range(h):
    for j in range(w):
        if a[i][j] == '
            row[i] = 1
            col[j] = 1

for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j], end = '')
        print()

Solution (Python):
H,W = map(int,input().split(" "))
grid = []
h = H
for i in range(h):
    row = input()
    if row == "."*W:
        H -= 1
        continue
    grid.append(list(row))
for i in range(W):
    flag = True
    for j in range(H):
        if grid[j][i] == "
            flag = False
    if flag == True:
        for j in range(H):
            grid[j][i] = ""
for i in range(H):
    row = ""
    for j in range(W):
        row += grid[i][j]
    print(row)

Solution (Python):
import sys

def del_add_dot_list(a):
    del_index = []
    for i in range(len(a)):
        if all(map(lambda x: x=='.', a[i])):
            del_index.append(i)
    for i in del_index[::-1]:
        del a[i]
    return a

def spin(a):
    if len(a[0]) == 1:
        return [''.join(list(map(lambda x: x[0], a)))]
    else:
        return [''.join(list(map(lambda x: x[0], a)))] + spin(list(map(lambda x: x[1:], a)))

def main():
    sys.setrecursionlimit(10000)
    h, w = map(int, input().split())
    a = [input() for i in range(h)]
    deleted = spin(del_add_dot_list(spin(del_add_dot_list(a))))
    [print(l) for l in deleted]

if __name__ == '__main__':
    main()

Solution (Python):
H, W = map(int, input().split())
A = [input() for i in range(H)]
P = [0]*H; Q = [0]*W
for i in range(H):
    P[i] = all(A[i][j] == '.' for j in range(W))
for i in range(W):
    Q[i] = all(A[j][i] == '.' for j in range(H))
for i in range(H):
    if P[i]:
        continue
    r = []
    for j in range(W):
        if Q[j]:
            continue
        r.append(A[i][j])
    print(*r, sep='')

Solution (Python):
H, W = list(map(int, input().strip().split(" ")))

field = []
hist = [0 for w in range(W)]

def shrink():
    newField = []
    for h in range(H):
        line = []
        for w in range(W):
            if(hist[w] != H):
                line.append(field[h][w])
        newField.append(line)        
    return newField            

for h in range(H):
    line = list(input().strip())
    if(line.count(".") != len(line)):
        field.append(list(line))
        for w in range(W):
            hist[w] += 1 if field[-1][w] == "." else 0 
H = len(field)

newField = shrink()

for h in newField:
    print("".join(h))

Solution (Python):
H, W = [int(i) for i in input().split()]
A = [input() for j in range(H)]

DH = set()
DW = set()

for h in range(H):
    for w in range(W):
        if A[h][w] == '
            DH.add(h)
            DW.add(w)

for h in range(H):
    if h in DH:
        for w in range(W):
            if w in DW:
                print(A[h][w], end='')
        print()

Solution (Python):
H, W= map(int, input().split())
A = [input() for i in range(H)]

v_list = []
reverse_list = [""]*W
h_list = []


def delete(h, input, output):
    for i in range(h):
        if "
            output.append(input[i])


def reverse(w, h, input, output):
    for i in range(w):
        for j in range(h):
            output[i] = output[i] + input[j][i]

delete(H, A, v_list)

reverse(W, len(v_list), v_list, reverse_list)

delete(W, reverse_list, h_list)

result_list = [""]*(len(h_list[0]))

reverse(len(h_list[0]), len(h_list), h_list, result_list)

for s in result_list:
    print(s)

Solution (Python):
h, w = map(int, input().split())
a = [input() for _ in range(h)]
ans_w = []
ans_h = []
for i in range(h):
  for j in range(w):
    if a[i][j] == "
      ans_h.append(i)
      break
for j in range(w):
  for i in range(h):
    if a[i][j] == "
      ans_w.append(j)
      break
for i in ans_h:
  print(*[a[i][j] for j in ans_w], sep="")

Solution (Python):
def rotate_clockwise(matrix):
    tmp = list(map(list, zip(*matrix)))[::-1]
    return list(''.join(row) for row in tmp)
    


def rotate_counterclockwise(matrix):
    tmp = list(map(lambda x: list(x[::-1]), zip(*matrix)))
    return list(''.join(row) for row in tmp)
    


H, W = [int(i) for i in input().split()]
A = [input() for _ in range(H)]

row_remove_count = 0
while '.' * W in A:
    A.remove('.' * W)  
    row_remove_count += 1

A = rotate_clockwise(A)  
while '.' * (H - row_remove_count) in A:
    A.remove('.' * (H - row_remove_count))

A = rotate_counterclockwise(A)  
print('\n'.join(A))

Solution (Python):
import numpy as np
H,W = map(int, input().split(" "))
a = []
for h in range(H):
    a.append(list(input()))
A = np.array(a)
A = (A=="
for h in range(H):
    word = ""
    for w in range(W):
        if any(A[h]) and any(A.T[w]):
             if A[h][w]:
                 word += "
             else:
                 word += "."
    if word :print(word)

Solution (Python):
h, w = map(int, input().split())
s = []
s0 = []
for i in range(h):
    s.append(input())

for i in range(h):
    if s[i].count('
        s0.append(s[i])

s1 = [list(a) for a in s0]

for i in range(len(s1[0])):
    for j in range(len(s1)):
        if s1[j][i] == '
            break
        elif j == len(s1) - 1:
            for k in range(len(s1)):
                s1[k][i] = 0
        else:
            continue
for r in s1:
    for c in r:
        if c != 0:
            print(c, end='')
    print()

Solution (Python):
H, W = map(int, input().split())
mas = []
deltags = []
for x in range(H):
    try:
        temp = list(input())
    except:
        pass
    if "
        mas.append(temp)

for x in range(len(mas[0])):
    deltag = False
    for y in range(len(mas)):
        if mas[y][x] == "
            break
        if y == len(mas)-1:
            deltag = True
    deltags.append(deltag)

for x in range(len(mas)):
    for y in range(len(mas[x])):
      if deltags[y]:
        mas[x][y] = "A"

try:
    x = 0
    while True:
        while "A" in mas[x]:
            mas[x].remove("A")
        print("".join(mas[x]))
        x += 1
except:
    pass

Solution (Python):
import numpy as np

H, W = map(int, input().split(" "))

lines = np.asarray([list(input().replace("\n", "")) for h in range(H)])

h_indexs, w_indexs = map(set, np.where(lines == "

outlines = lines[list(h_indexs), :][:, list(w_indexs)]
for outline in outlines:
    print("".join(outline))

Solution (Python):
H,W=map(int,input().split())
A=[input() for i in range(H)]
tate=[0]*H
yoko=[0]*W
for i in range(W):
    for j in range(H):
        if A[j][i]=="
            tate[j]=1
            yoko[i]=1
ans=[]
for j in range(H):
    if tate[j]==0:
        continue
    a=''
    for i in range(W):
        if yoko[i]==0:
            continue
        a+=A[j][i]
    ans.append(a)
for a in ans:
    print(a)

Solution (Python):


H,W = map(int, input().split())
HW = []
for i in range(H):
    instr = input()
    
    if instr.find('
        HW.append(list(instr))
    
    else:
        H -= 1


col = [False] * W
for i in range(H):
    for j in range(W):
        if HW[i][j] == '
            
            col[j] = True

for i in range(H):
    for j in range(W):
        if col[j]:
            
            print(HW[i][j], end='')
    
    print()

Solution (Python):
h, w = list(map(int, input().split()))
init_board = []
for i in range(h):
    init_board.append([_ for _ in input()])

board = []

for i in range(h):
    if init_board[i] != ["."] * w:
        board.append(init_board[i])


new_board = []
for i in range(w):
    add_row = []
    for j in range(len(board)):
        add_row.append(board[j][i])
    if add_row != ["."] * len(add_row):
        new_board.append(add_row)


answer_board = []
for i in range(len(new_board[0])):
    add_row = []
    for j in range(len(new_board)):
        add_row.append(new_board[j][i])
    answer_board.append(add_row)


for i in range(len(answer_board)):
    print("".join(answer_board[i]))

Solution (Python):
H, W= map(int, input().split())
A = [input() for i in range(H)]

v_list = []
reverse_list = [""]*W
h_list = []


def delete(h, input, output):
    for i in range(h):
        if "
            output.append(input[i])

delete(H, A, v_list)


for i in range(W):
    for j in range(len(v_list)):
        reverse_list[i] = reverse_list[i] + v_list[j][i]


delete(W, reverse_list, h_list)

result_list = [""]*(len(h_list[0]))


for i in range(len(h_list[0])):
    for j in range(len(h_list)):
        result_list[i] = result_list[i] + h_list[j][i]

for s in result_list:
    print(s)

Solution (Python):
H, W= map(int, input().split())
A = [input() for i in range(H)]

v_list = []
reverse_list = [""]*W
h_list = []

for i in range(H):
    if "
        v_list.append(A[i])

for i in range(W):
    for j in range(len(v_list)):
        reverse_list[i] = reverse_list[i] + v_list[j][i]

for i in range(W):
    if "
        h_list.append(reverse_list[i])

result_list = [""]*(len(h_list[0]))

for i in range(len(h_list[0])):
    for j in range(len(h_list)):
        result_list[i] = result_list[i] + h_list[j][i]

for s in result_list:
    print(s)

Solution (Python):
import numpy as np
h, w = list(map(int, input().split()))
a = np.array([list(input()) for i in range(h)])
a = a[:, ~np.all(a=='.', axis=0)]
a = a[~np.all(a=='.', axis=1)]
for i in range(len(a)):
    print(''.join(a[i]))

Solution (Python):
h , w = map(int, input().split())
a = [list(input()) for _ in range(h)]
good_r = [False for _ in range(h)]
good_c = [False for _ in range(w)]

for i in range(h):
    for j in range(w):
        if a[i][j] == '
            good_r[i] = True
            good_c[j] = True

for i in range(h):
    if good_r[i]:
        string = ''
        for j in range(w):
            if good_c[j]:
                string += a[i][j]
        if len(string) > 0:
            print(string)

Solution (Python):
def rotated(a):
    b = []
    for i in range(len(a[0])):
        b.append("")
        for j in range(len(a)):
            b[-1] += a[j][i]
    return b

H, W = map(int, input().split())
a = []

for i in range(H):
    ai = input()
    if "
        a.append(ai)

a = rotated(a)

for i in range(len(a) - 1, -1, -1):
    if "
        a.remove(a[i])

a = rotated(a)

print("\n".join(a))

Solution (Python):
h,w=map(int, input().split())
s = [list(input()) for i in range(h)]
s=[i for i in s if '
count=0
while count<len(s[0]):
    check=0
    for i in s:
        if i[count]=='
            check=1
    if check==0:
        for i in s:
            i.pop(count)
    else:count+=1
for i in s:print(''.join(i))

Solution (Python):
H, W = map( int, input().split())
A = [ list( input()) for _ in range(H)]
Flag = True
yoko = [0]*H
tate = [0]*W
for i in range(H):
    for j in range(W):
        if A[i][j] == '
            yoko[i] = 1
            break
for j in range(W):
    for i in range(H):
        if A[i][j] == '
            tate[j] = 1
ANS = []
for i in range(H):
    if yoko[i] == 0:
        continue
    ans = ''
    for j in range(W):
        if tate[j] == 1:
            ans += A[i][j]
    ANS.append(ans)
for ans in ANS:
    print(ans)

Solution (Python):
H, W = map(int, input().split())
field = [input() for _ in range(H)]
hi, wi = set(), set()
for i in range(H):
    if not('
        hi.add(i)
for i in range(W):
    f = False
    for j in range(H):
        if field[j][i] == '
            f = True
    if not f:
        wi.add(i)
for i in range(H):
    if i in hi:
        continue
    for j in range(W):
        if j in wi:
            continue
        print(field[i][j], end="")
    print("")

Solution (Python):
h,w = map(int, input().split())

import numpy as np

f = []
for i in range(h):
    f.append(list(map(lambda x: 0 if x=='.' else 1, list(input()))))
f = np.matrix(f)

for _ in range(2):
    f = f.T
    g = []
    for i in range(f.shape[0]):
        if np.sum(f[i]) > 0:
            g.append(f[i].tolist()[0])
    f = np.matrix(g)

for i in range(len(f)):
    print("".join(list(map(lambda x:str(x), np.array(f[i]).ravel().tolist()))).replace('1','

Solution (Python):
h,w=map(int,input().split())
tmp=[]
jg=[0 for _ in range(0,w)]
s=""
for i in range(0, h):
    s = input()
    if s != '.'*w:
        tmp.append(s)
    for j in range(0,len(s)):
        if s[j] == '
            jg[j] = 1
rs=[]
for i in range(0, len(tmp)):
    s=list(tmp[i])
    for k in range(0,w):
        if jg[k] == 0:
            s[k] = ''
    rs.append(s)
for _ in rs:
    print(''.join(_))

Solution (Python):
h, w = [int(i) for i in input().split()]
 
s = []
for i in range(h):
  s.append(input())

set_i = set()  
set_j = set()

for i in range(h):
    for j in range(w):
      if s[i][j] =="
        set_i.add(i)
        set_j.add(j)
        
for i in range(h):
  answer = ""
  if i in set_i:
    for j in range(w):
      if j in set_j:
        answer += s[i][j]
    print(answer)

Solution (Python):
import os
import sys

aa = input().strip().split()
h = int(aa[0])
w = int(aa[1])
a = [list(input().strip()) for _ in range(h)]
r = [[False for _ in range(i)] for i in [h, w]]

for i in range(h):
    for j in range(w):
        if a[i][j] == '
            r[0][i] = True
            r[1][j] = True

for i in range(h):
    if r[0][i]:
        for j in range(w):
            if r[1][j]:
                sys.stdout.write(a[i][j])

        sys.stdout.write(os.linesep)

Solution (Python):
h,w = (int(i) for i in input().split())
a,b = [],["" for i in range(w)]
for _ in range(h):
	s = input()
	if s.count("
		a.append(s)
		for i in range(w): b[i]+=s[i]
num,ans = [True for i in range(w)],["" for i in range(len(a))]
for i in range(w):
	if b[i].count("
for i in range(len(a)):
	for j in range(w):
		if num[j]: ans[i]+=a[i][j]
for i in ans: print(i)

Solution (Python):
from sys import stdin                                                                                                                                                                                                                
                                                                                                                                                                                                                                     
h, w = [int(x) for x in stdin.readline().rstrip().split()]                                                                                                                                                                           
                                                                                                                                                                                                                                     
a = []                                                                                                                                                                                                                               
for _ in range(h):                                                                                                                                                                                                                   
    i = list(input())                                                                                                                                                                                                                
    if "
        a.append(i)                                                                                                                                                                                                                  
ans = zip(*[x for x in zip(*a) if "
for s in ans:                                                                                                                                                                                                                        
    print(*s, sep="")

Solution (Python):
H, W = map(int, input().split())
row=[]
for i in range(H):
    row.append(input())
i=0
while(True):
    if('.'*W in row):
        row.remove('.'*W)
    else:
        break
columns=[]
for i in range(W):
    for j in range(len(row)):
        if(j==0):
            columns.append(row[j][i])
        else:
            columns[i]+=row[j][i]
while(True):
    if('.'*(len(row)) in columns):
        columns.remove('.'*len(row))
    else:
        break
row = []
for i in range(len(columns[0])):
    for j in range(len(columns)):
        if(j==0):
            row.append(columns[j][i])
        else:
            row[i]+=columns[j][i]
for i in range(len(row)):
    print(row[i])

Solution (Python):
a, b = map(int, input().split(" "))

c = [list(input()) for i in range(a)]

d = [False, 0]

for i in range(a):
    if d[0]:
        i -= d[1]
    if c[i] == ['.' for i in range(b)]:
        del c[i]
        d[0] = True
        d[1] += 1
a -= d[1]
c = list(map(list, zip(*c)))
d = [False, 0]

for i in range(b):
    if d[0]:
        i -= d[1]
    if c[i] == ['.' for i in range(a)]:
        del c[i]
        d[0] = True
        d[1] += 1
b -= d[1]

if len(c) == 1:
    print("
else:
    for i in list(map(list, zip(*c))):
        for j in range(b):
            print(i[j], end="")
        print()

Solution (Python):
H,W=map(int,input().split())
a=[list(input()) for i in range(H)]
X=[0 for i in range(W)]
Y=[0 for i in range(H)]
for i in range(H):
    flag=0
    for j in range(W):
        if a[i][j]=="
            flag=1
            break
    if flag==0:
        Y[i]=1
for j in range(W):
    flag=0
    for i in range(H):
        if a[i][j]=="
            flag=1
            break
    if flag==0:
        X[j]=1
for i in range(H):
    st=""
    if Y[i]==1:
        continue
    for j in range(W):
        if X[j]==0:
            st+=a[i][j]
    print(st)

Solution (Python):
import numpy as np

H,W=map(int,input().split())
field=[list(input()) for i in range(H)]

field=[i for i in field if "

field=np.array(field)


field=np.rot90(field,k=1)
field=field.tolist()

field=[i for i in field if "

field=np.rot90(field,k=-1)
field=field.tolist()


for i in field:
    print("".join(i))

Solution (Python):
import numpy as np
def f(s):
    s = s.replace('.', '0')
    s = s.replace('
    lst = [int(n) for n in s]
    return np.array(lst)
h, w = list(map(int, input().split()))
a = np.array([f(input()) for i in range(h)])
b = a[:, ~np.all(a==0, axis=0)]
ans_ = b[~np.all(a==0, axis=1)]
ans = ans_.tolist()
for i in range(len(ans)):
    out3 = [str(n) for n in ans[i]]
    out2 = ''.join(out3)
    out1 = out2.replace('0', '.')
    out0 = out1.replace('1', '
    print(out0)

Solution (Python):
arg1, arg2 = input().split()


input_list = []
for i in range(int(arg1)):
    input_list.append(input())


target_list = []
for row in input_list:
    target_list.append(list(row))





target_list2 = []
for i in range(len(target_list)):
    for j in range(len(target_list[i])):
        if target_list[i][j] == '
            target_list2.append(target_list[i])
            break



target_list3 = list(map(list, zip(*target_list2)))



target_list4 = []
for i in range(len(target_list3)):
    for j in range(len(target_list3[i])):
        if target_list3[i][j] == '
            target_list4.append(target_list3[i])
            break



ans_list = list(map(list, zip(*target_list4)))



for row in ans_list:
    moji = ''
    for x in row:
        moji += x
    print(moji)

Solution (Python):
[h,w]=[int(i) for i in input().split()]

li=[]
for i in range(h):
    li.append(list(input()))

p=[]
count=0
for j, i in enumerate(li):
    if "
        p.append(j)
        h-=1
for i in p:
    temp=i-count
    del li[temp]
    count+=1


tli=[]
for i in range(w):
    temp=[]
    for j in li:
        temp.append(j[i])
    tli.append(temp)

count=0
p=[]
for k, i in enumerate(tli):
    if "
        p.append(k)
        w-=1
for i in p:
    temp=i-count
    del tli[temp]
    count+=1

for i in range(h):
    for j in range(w):
        print(tli[j][i], end="")
    print()

Solution (Python):
h, w = map(int, input().split())
grid = []

def method(grid, cnt, i):
    if cnt == len(grid) - 1 and grid[cnt][i] == '.':
        w_list.append(i)
    elif cnt < len(grid) - 1 and grid[cnt][i] == '.':
        method(grid, cnt + 1, i)
    else:
        False


for i in range(h):
    n = list(input())
    if n.count('.') == len(n):
        pass
    else:
        grid.append(n)

w_list = []
cnt = 0
for i in range(w):
    
    
    
    
    
    
    
    method(grid, cnt, i)

w_list.reverse()

for n in w_list:
    for i in grid:
        i.pop(n)


for i in grid:
    print(''.join(i))

Solution (Python):
row_num, col_num = (int(i) for i in input().split())
matrix = [ list(input()) for i in range(row_num)]
transpose_matrix = []
for i in range(col_num):
    transpose_matrix.append([])
    for j in range(row_num):
        transpose_matrix[i].append(matrix[j][i])

empty_rows = []

for i,line in enumerate(matrix):
    if '
        continue
    empty_rows.append(i)
empty_cols = []

for i,line in enumerate(transpose_matrix):
    if '
        continue
    empty_cols.append(i)

for i in range(row_num):
    if i in empty_rows:
        continue
    for j in range(col_num):
        if j in empty_cols:
            continue
        print(matrix[i][j],end="")
    print()

Solution (Python):
h,w = map(int,input().split())
a = []
for i in range(h):
    s=list(input())
    if s.count('
        a.append(s)



for i in range(len(a[0])):
    k = 0
    for j in range(len(a)):
        if a[j][i] == '.':
            k += 1
    if k == len(a):
        for j in range(len(a)):
            a[j][i] = 'a'
    k = 0


for i in range(len(a)):
    ans = ''
    for j in range(len(a[0])):
        if a[i][j] != 'a':
            ans += a[i][j]
    print(ans)

Solution (Python):
import numpy as np

H,W = list(map(int,input().split()))



dot=[]
for h in range(H):
    d=input().strip()
    if '
        dot.append(list(d))
    

dot = np.array(dot).T

dot2=[]
for d in range(len(dot)):
    if '
        dot2.append(dot[d])

dot2 = np.array(dot2).T



for h in range(len(dot2)):
    print("".join(dot2[h]))

Solution (Python):
import copy

H,W = map(int,input().split())
a = []
for i in range(H):
    a.append(input().split())
aa = copy.copy(a)

aaa = 0
d = ""
for i in range(W):
    d += "."
for i in range(H):
    if a[i][0] == d:
        aa.pop(i-aaa)
        aaa += 1

b = []
bb = ""
for i in range(W):
    for j in range(H-aaa):
        bb += aa[j][0][i]
    b.append(bb)
    bb = ""

d = ""
for i in range(H-aaa):
    d += "."

bc = copy.copy(b)
bbb = 0
for i in range(W):
    if b[i] == d:
        bc.pop(i-bbb)
        bbb += 1

ans = []
ansc = ""
for i in range(H-aaa):
    for j in range(W-bbb):
        ansc += bc[j][i]
    ans.append(ansc)
    ansc = ""

for i in range(H-aaa):
    print(ans[i])

Solution (Python):
h, w = (int(_) for _ in input().split())
l = [str(input()) for i in range(h)]

for si in l[:]:
    if si.count('.') == len(si):
        l.remove(si)
h = len(l)

rl = []
for i in range(w):
    tl = []
    for js in l:
        tl.append(js[i])
    rl.append(''.join(tl))

for si in rl[:]:
    if si.count('.') == len(si):
        rl.remove(si)
w = len(rl[0])

al = []
for i in range(w):
    tl = []
    for js in rl:
        tl.append(js[i])
    al.append(''.join(tl))

for si in al:
    print(si)

Solution (Python):
H,W = list(map(int,input().split(" ")))
a = [list(input()) for i in range(H)]
h = []
w = []
for i in range(0,H):
    if "
        h+=[(i,j,) for j in range(W)]

for i in range(W):
    for j in range(H):
        if a[j][i] != ".":
            break
        else:
            w.append(i)
    if w.count(i) == H:
        h+=[(k,i) for k in range(H)]
r = []
for i in range(H):
    c =[]
    for j in range(W):
        if (i,j,) in h:
            continue
        else:
            c.append(a[i][j])
    r.append(c)
for i in r:
    if i != []:
        print("".join(i))

Solution (Python):

import numpy as np

H, W = map(int, input().split())
cell = []
for i in range(H):
    cell.append(input())

mat = np.empty((H, W))
for i in range(H):
    for j in range(W):
        if cell[i][j] == '.':
            mat[i,j] = 0
        if cell[i][j] == '
            mat[i,j] = 1

col_del = np.all(mat == 0, axis=0)
row_del = np.all(mat == 0, axis=1)
col_index = np.where(col_del==True)
row_index = np.where(row_del==True)


res = np.delete(mat, row_index, axis=0)
res = np.delete(res, col_index, axis=1)

Hn = res.shape[0]
Wn = res.shape[1]

a =''
for i in range(Hn):
    ans = []
    for j in range(Wn):
        if res[i,j] == 0:
            ans.append('.')

        if res[i,j] == 1:
            ans.append('
    
    a += '\n' + ''.join(ans)

print(a)

Solution (Python):
h,w = map(int,input().split())
a = []
for i in range(h):
    ans = str(input())
    a.append((ans))
a_h = []
for i in range(h):
    check_h = False
    for j in range(w):
        if a[i][j] == '
            check_h = True
    if check_h:
        a_h.append(a[i])
ans = ['']*len(a_h)
for i in range(w):
    check_w = False
    for j in range(h):
        if a[j][i] == '
            check_w = True
    if check_w:
        for k in range(len(a_h)):
            ans[k] += a_h[k][i]
for i in range(len(ans)):
    print(ans[i])

Solution (Python):
H,W = map(int,input().split())
li = [input() for i in range(H)]
num_lists = []
num_lists2 = []
for i in range(H):
    if "
        print("") 
    else :
        num_lists.append(i)
for i in reversed(num_lists):
    li.pop(i)
n_H = len(li)
for i in range(W) :
    ch_li = []
    for j in range(n_H):
        ch_li.append(li[j][i])
    if "
        print("")
    else :
        num_lists2.append(i)
for i in reversed(num_lists2):
    for k in range(n_H) :
        li[k] = li[k][:i]+li[k][(i+1):]
        
for i in li:
    for j in i:
        print(j,end="")
    print()

Solution (Python):
HW = input()
masu = "none"
hw = HW.split()

Adata = []
for lop in range(int(hw[0])):
    A = input()
    Adata.append(A)

x = []
y = []
buf = ""
for lop in range(int(hw[0])):
    if str(Adata[lop]).find("
      x.append(lop)
      
for lop in range(int(hw[1])):
    for lop2 in range(int(hw[0])):
        buf = buf + str(Adata[lop2][lop])
    if str(buf).find("
        y.append(lop)
    buf = ""

for lop in range(len(x)-1,-1,-1):
    Adata.pop(x[lop])


ans = []
for lop in range(len(Adata)):
    buf = list(Adata[lop])
    for lop2 in range(len(y)-1,-1,-1):
        buf.pop(y[lop2])
    ans.append(buf)

for lop in range(len(ans)):
    ANS = ""
    for lop2 in range(len(ans[0])):
        ANS += ans[lop][lop2]
    print(ANS)

Solution (Python):
h, w = map(int,input().split())
arr = [list(input()) for i in range(h)]
tmp = []
for i in arr:
    if "
        tmp.append(i)
ans = [[] for i in range(len(tmp))]
for i in range(w):
    count = 0
    for j in range(len(tmp)):
        if tmp[j][i] == ".":
            count += 1
    if count < len(tmp):
        for j in range(len(ans)):
            ans[j].append(tmp[j][i])

for i in ans:
    for j in range(len(ans[0])):
        print(i[j], end="")
    print()

Solution (Python):
import numpy as np

h,w=map(int,input().split())
tmp=[]
for i in range(h):
        a=list(input())
        tmp.append(a)
ans1=[]
if(w!=1):
    for i in range(h):
        if(len(set(tmp[i]))==1 and tmp[i][0]!="
            ans1.append(i)
ans2=[]
tmp=list(map(list,zip(*tmp)))
if(h!=1):
    for i in range(w):
        if(len(set(tmp[i]))==1 and tmp[i][0]!="
            ans2.append(i)

tmp=list(map(list,zip(*tmp)))
tmp=np.delete(tmp,ans1,axis=0)
tmp=np.delete(tmp,ans2,axis=1)
for i in range(len(tmp)):
    for j in range(len(tmp[0])):
        print(tmp[i][j],end="")
    print()