def main(): h, w = list(map(int, input().split())) S = ["#"*(w+2)] + ["#"+input()+"#" for _ in range(h)] + ["#"*(w+2)] h += 2 w += 2 A = [[S[y][x] for x in range(w)] for y in range(h)] Ans = [] for y in range(1, h-1): for x in range(1, w-1): f0 = f1 = 0 s0 = s1 = "-" if S[y][x-1] + S[y][x] + S[y][x+1] == "#..": f0 = 1 nx = x while S[y][nx] == ".": nx += 1 s0 = "a"*(nx-x) if S[y-1][x] + S[y][x] + S[y+1][x] == "#..": f1 = 1 ny = y while S[ny][x] == ".": ny += 1 s1 = "a"*(ny-y) if f0 or f1: Ans.append((s0, s1)) print(len(Ans)) for s0, s1 in Ans: print(s0, s1) main()