Buggy python submission (verdict: Runtime Error):
def get_input():
      w = input()
      h = input()
      a = []
      for i in range(w):
            sub_a = []
            for j in range(h):
                  sub_a.append(raw_input())
            a.append(sub_a)
      return a

def transpose(mat):
      mat2 =[[row[i] for row in mat] for i in range(len(mat[0]))]
      return mat2

def get_output(mat):
      # done_flag = False
      point_count = 0
      i = 0
      while i<len(mat):
            j = 0
            while j<len(mat[0]):
                  if(mat[i][j] == '.'):
                        point_count += 1
                  j+=1            
            
            if point_count == len(mat[0]):
                  del mat[i]
                  i = 0
                  point_count = 0
                  continue
            i+=1
            point_count = 0
            # print(mat)

      mat = transpose(mat)

      point_count = 0
      i = 0
      while i<len(mat):
            j = 0
            while j<len(mat[0]):
                  if(mat[i][j] == '.'):
                        point_count += 1
                  j+=1            
            
            if point_count == len(mat[0]):
                  del mat[i]
                  i = 0
                  point_count = 0
                  continue
            i+=1
            point_count = 0
            # print(mat)

      return transpose(mat)

if __name__ == '__main__':
    mat = get_input()
    mat2 = get_output(mat)

    print mat2

# del a[1]

Fixed submission:
h, w = [int(n) for n in input().split()]
grid = [input() for _ in range(h)]
row_hashs = set()
column_hashs = set()

for i, row in enumerate(grid):
    for j, ch in enumerate(row):
        if ch == '#':
            row_hashs.add(i)
            column_hashs.add(j)

new_grid = []

for i, row in enumerate(grid):
    if i not in row_hashs:
        continue
    new_grid.append([])
    for j, ch in enumerate(row):
        if j not in column_hashs:
            continue
        new_grid[-1].append(ch)
    new_grid[-1] = "".join(new_grid[-1])


print("\n".join(new_grid))
# print(*new_grid, sep="\n")

Buggy python submission (verdict: Runtime Error):
def get_input():
      w = input()
      h = input()
      a = []
      for i in range(w):
            sub_a = []
            for j in range(h):
                  sub_a.append(raw_input())
            a.append(sub_a)
      return a

def transpose(mat):
      mat2 =[[row[i] for row in mat] for i in range(len(mat[0]))]
      return mat2

def get_output(mat):
      # done_flag = False
      point_count = 0
      i = 0
      while i<len(mat):
            j = 0
            while j<len(mat[0]):
                  if(mat[i][j] == '.'):
                        point_count += 1
                  j+=1            
            
            if point_count == len(mat[0]):
                  del mat[i]
                  i = 0
                  point_count = 0
                  continue
            i+=1
            point_count = 0
            print(mat)

      mat = transpose(mat)

      point_count = 0
      i = 0
      while i<len(mat):
            j = 0
            while j<len(mat[0]):
                  if(mat[i][j] == '.'):
                        point_count += 1
                  j+=1            
            
            if point_count == len(mat[0]):
                  del mat[i]
                  i = 0
                  point_count = 0
                  continue
            i+=1
            point_count = 0
            print(mat)

      return transpose(mat)

if __name__ == '__main__':
    mat = get_input()
    mat2 = get_output(mat)

    print mat2

# del a[1]

Fixed submission:
h, w = [int(n) for n in input().split()]
grid = [input() for _ in range(h)]
row_hashs = set()
column_hashs = set()

for i, row in enumerate(grid):
    for j, ch in enumerate(row):
        if ch == '#':
            row_hashs.add(i)
            column_hashs.add(j)

new_grid = []

for i, row in enumerate(grid):
    if i not in row_hashs:
        continue
    new_grid.append([])
    for j, ch in enumerate(row):
        if j not in column_hashs:
            continue
        new_grid[-1].append(ch)
    new_grid[-1] = "".join(new_grid[-1])


print("\n".join(new_grid))
# print(*new_grid, sep="\n")