h, w = map(int, input().split()) m = [[0] * w for i in range(h)] for i in range(h): s = input() for j in range(w): if s[j] == "o": m[i][j] = 1 elif s[j] == "x": m[i][j] = -1 ans = [[0] * w for i in range(h)] print(m) kane = [[0] * w for i in range(h)] for i in range(h): for j in range(w): if i == 0: if j == 0: ans[i][j] = 1 elif ans[i][j - 1] == 0: ans[i][j] = 0 elif m[i][j] == 1: ans[i][j] = ans[i][j - 1] + 1 elif m[i][j] == -1: ans[i][j] = ans[i][j - 1] - 1 elif j == 0: if ans[i - 1][j] == 0: ans[i][j] = 0 elif m[i][j] == 1: ans[i][j] = ans[i - 1][j] + 1 elif m[i][j] == 0: ans[i][j] = ans[i - 1][j] - 1 else: ans[i][j] = ans[i - 1][j] + ans[i][j - 1] if ans[i][j] < 0: ans[i][j] = 0 print(ans)#okanenokanri