### BUGGY CODE ###

from networkx import*

N, M = map(int, input().split())
A = [[a for a in input()] for _ in range(N)]
X = [[1 if a == "." else 0 for a in aa] for aa in A]
G = DiGraph()
G.add_nodes_from(range(N * M + 2))
s = N * M
t = s + 1
for i in range(N):
    for j in range(M):
        if X[i][j]:
            if (i ^ j) & 1 == 0:
                G.add_edge(s, i * M + j, capacity = 1)
            else:
                G.add_edge(i * M + j, t, capacity = 1)

for i in range(N - 1):
    for j in range(M):
        if X[i][j] and X[i+1][j]:
            a = i * M + j
            b = a + M
            if (i ^ j) & 1 == 0:
                G.add_edge(a, b, capacity = 1)
            else:
                G.add_edge(b, a, capacity = 1)
for i in range(N):
    for j in range(M - 1):
        if X[i][j] and X[i][j+1]:
            a = i * M + j
            b = a + 1
            if (i ^ j) & 1 == 0:
                G.add_edge(a, b, capacity = 1)
            else:
                G.add_edge(b, a, capacity = 1)

ans, mf = maximum_flow(G, s, t)
for a in mf:
    for b in mf[a]:
        v = mf[a][b]
        if v:
            if a >= N * M or b >= N * M: continue
            aa, bb = (a, b) if a < b else (b, a)
            i, j = aa // M, aa % M
            ii, jj = bb // M, bb % M
            if i == ii:
                A[i][j] = ">"
                A[ii][jj] = "<"
            else:
                A[i][j] = "v"
                A[ii][jj] = "^"

print(ans)
for x in A:
    print("".join(map(str, x)))


### FIXED CODE ###

def FF(E, s, t, nn):
    G = [[] for _ in range(nn)]
    for a, b, f in E:
        G[a].append([b, f, len(G[b])])
        G[b].append([a, 0, len(G[a])-1])
    
    def dfs(s, t, f):
        if s == t:
            return f
        used[s] = 1
        for i, (b, _f, r) in enumerate(G[s]):
            if used[b] or _f == 0: continue
            d = dfs(b, t, min(f, _f))
            if d > 0:
                G[s][i][1] -= d
                G[b][r][1] += d
                return d
        return 0
    
    flow = 0
    while 1:
        used = [0] * nn
        f = dfs(s, t, 10**100)
        if f == 0:
            return flow, G
        flow += f

E = []
N, M = map(int, input().split())
A = [[a for a in input()] for _ in range(N)]
X = [[1 if a == "." else 0 for a in aa] for aa in A]
s = N * M
t = s + 1
for i in range(N):
    for j in range(M):
        if X[i][j]:
            if (i ^ j) & 1 == 0:
                E.append((s, i * M + j, 1))
            else:
                E.append((i * M + j, t, 1))

for i in range(N - 1):
    for j in range(M):
        if X[i][j] and X[i+1][j]:
            a = i * M + j
            b = a + M
            if (i ^ j) & 1 == 0:
                E.append((a, b, 1))
            else:
                E.append((b, a, 1))
for i in range(N):
    for j in range(M - 1):
        if X[i][j] and X[i][j+1]:
            a = i * M + j
            b = a + 1
            if (i ^ j) & 1 == 0:
                E.append((a, b, 1))
            else:
                E.append((b, a, 1))

D = {}
for a, b, v in E:
    D[(a << 16) + b] = v

ans, mf = FF(E, s, t, t + 1)
for a in range(t + 1):
    for b, w, _ in mf[a]:
        ab = (a << 16) + b
        if ab not in D: continue
        if w == 0:
            if a >= N * M or b >= N * M: continue
            aa, bb = a, b
            i, j = aa // M, aa % M
            ii, jj = bb // M, bb % M
            v = D[ab] - w
            aa, bb = (a, b) if a < b else (b, a)
            i, j = aa // M, aa % M
            ii, jj = bb // M, bb % M
            if i == ii:
                A[i][j] = ">"
                A[ii][jj] = "<"
            else:
                A[i][j] = "v"
                A[ii][jj] = "^"

print(ans)
for x in A:
    print("".join(map(str, x)))