import sys
from collections import *

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]
dij = [(1, 0), (-1, 0), (0, 1), (0, -1)]

# __dfsのflow_to_meの初期値がinfに相当するか注意
# n頂点,sスタート,tゴール
class Dinic:
    def __init__(self, n, s, t):
        self.n, self.s, self.t = n, s, t
        self.to = [[] for _ in range(n)]
        self.max_flow = -1

    def add_edge(self, u, v, cap):
        u_index_in_to_v = len(self.to[v])
        v_index_in_to_u = len(self.to[u])
        self.to[u].append([v, cap, u_index_in_to_v])
        self.to[v].append([u, 0, v_index_in_to_u])

    # 無向辺の追加
    def add_undir_edge(self, u, v, cap):
        u_index_in_to_v = len(self.to[v])
        v_index_in_to_u = len(self.to[u])
        self.to[u].append([v, cap, u_index_in_to_v])
        self.to[v].append([u, cap, v_index_in_to_u])

    def __set_level(self):
        s = self.s
        level = [-1] * self.n
        level[s] = 0
        q = deque()
        q.append([s, 0])
        while q:
            u, u_level = q.popleft()
            for v, cap, _ in self.to[u]:
                if cap == 0: continue
                if level[v] != -1: continue
                level[v] = u_level + 1
                if v == self.t:
                    self.level = level
                    return True
                q.append([v, u_level + 1])
        return False

    def __dfs(self, u=-1, flow_to_me=10 ** 16):
        if u == -1: u = self.s
        if u == self.t: return flow_to_me
        flow_from_me = 0
        u_level = self.level[u]
        for utov_i, (v, cap, vtou_i) in enumerate(self.to[u]):
            if self.level[v] != u_level + 1: continue
            if cap == 0: continue
            flow_to_v = self.__dfs(v, min(cap, flow_to_me - flow_from_me))
            if not flow_to_v: continue
            flow_from_me += flow_to_v
            self.to[u][utov_i][1] -= flow_to_v
            self.to[v][vtou_i][1] += flow_to_v
        return flow_from_me

    def __calculation(self):
        res = 0
        while self.__set_level():
            res += self.__dfs()
        return res

    # これが出力用
    def get_max_flow(self):
        if self.max_flow == -1:
            self.max_flow = self.__calculation()
        return self.max_flow

h,w=MI()
ss=[list(SI()) for _ in range(h)]
mf=Dinic(h*w+2,h*w,h*w+1)
for i in range(h):
    for j in range(w):
        if ss[i][j]=="#":continue
        if (i+j)%2:
            mf.add_edge(i*w+j,h*w+1,1)
        else:
            mf.add_edge(h*w,i*w+j,1)
            for di,dj in dij:
                ni,nj=i+di,j+dj
                if ni<0 or nj<0 or ni>=h or nj>=w:continue
                if ss[ni][nj]=="#":continue
                mf.add_edge(i*w+j,ni*w+nj,1)

ans=mf.get_max_flow()

for i in range(h):
    for j in range(w):
        if (i+j)%2:continue
        u=i*w+j
        for v,cap,_ in mf.to[u]:
            if cap:continue
            if v==h*w:continue
            dir=[w,-w,1,-1].index(u-v)
            ss[i][j]="^v<>"[dir]
            ss[v//w][v%w]="v^><"[dir]

print(ans)
for row in ss:print("".join(row))


Measured memory_bytes: 18956