N,M=list(map(int,input().split()))

S=[list(eval(input())) for i in range(N)]

V=N*M

G=[[] for i in range(V)]

ma=[0]*V

us=[0]*V

def ae(u,v):

  G[u].append(v)

  G[v].append(u)



def df(v):

  us[v]=1

  for i in range(len(G[v])):

    u=G[v][i]

    w=ma[u]

    if w<0 or(not(us[w]) and df(w)):

      ma[v]=u

      ma[u]=v

      return 1

  return 0



def mat():

  r=0

  for i in range(V):

    ma[i]=-1

  for v in range(V):

    if ma[v]<0:

      for i in range(V):

        us[i]=0

      if df(v):

        r+=1

  return r



w4y=[1,0,-1,0]

w4x=[0,1,0,-1]

for i in range(N):

  for j in range(M):

    if ((i+j+1)&1)and(S[i][j]=='.'):

      for k in range(4):

        k=[i+w4y[k],j+w4x[k]]

        if min(k)<0 or k[0]>=N or k[1]>=M:

          continue

        if S[k[0]][k[1]]=='.':

          ae(i*M+j,k[0]*M+k[1])

print((mat()))

for i in range(N):

  for j in range(M):

    if ma[i*M+j]<0:

      continue

    if ma[i*M+j]==i*M+j+M:

      S[i][j]='v'

    elif ma[i*M+j]==i*M+j-M:

      S[i][j]='^'

    elif ma[i*M+j]==i*M+j+1:

      S[i][j]='>'

    elif ma[i*M+j]==i*M+j-1:

      S[i][j]='<'

  print((''.join(S[i])))
from collections import deque

N,M=list(map(int,input().split()))

S=[list(eval(input())) for i in range(N)]

V=N*M+2

G=[[] for i in range(V)]

L=[0]*V

I=[0]*V

INF=10**15

def ae(fr,to,ca):

  global G

  G[fr].append([to,ca,len(G[to]),0])

  G[to].append([fr,0,len(G[fr])-1,0])



def bfs(s):

  global INF,L,V,G

  L=[-1]*V

  Q=deque()

  L[s]=0

  Q.append(s)

  while(len(Q)):

    x=Q.popleft()

    for i in range(len(G[x])):

      if G[x][i][1]>0 and L[G[x][i][0]]<0:

        L[G[x][i][0]]=L[x]+1

        Q.append(G[x][i][0]) 



def dfs(v,t,f):

  global I,G,V

  if v==t:

    return f

  for i in range(I[v],len(G[v])):

    if G[v][i][1]>0 and L[v]<L[G[v][i][0]]:

      d=dfs(G[v][i][0],t,min(f,G[v][i][1]))

      if d>0:

        G[v][i][1]-=d

        G[v][i][3]+=d

        G[G[v][i][0]][G[v][i][2]][1]+=d

        G[G[v][i][0]][G[v][i][2]][3]-=d

        return d

    I[v]+=1

  return 0



def mf(s,t):

  global L,I,INF,V

  fl=0

  while(True):

    bfs(s)

    if L[t]<0:

      break

    I=[0]*V

    f=0

    while(True):

      f=dfs(s,t,INF)

      if f<=0:

        break

      fl+=f

  return fl



w4x=[0,1,0,-1]

w4y=[1,0,-1,0]

v=0

for i in range(N):

  for j in range(M):

    if (i+j)&1:

      ae(i*M+j,V-1,1)

      continue

    ae(V-2,i*M+j,1)

    if S[i][j]=='#':

      continue

    for k in range(4):

      v=[i+w4y[k],j+w4x[k]]

      if min(v)<0 or v[0]==N or v[1]==M:

        continue

      if S[v[0]][v[1]]=='.':

        ae(i*M+j,v[0]*M+v[1],1)

print((mf(V-2,V-1)))

for i in range(N*M):

  for j in range(len(G[i])):

    if G[i][j][3]>0:

      v=G[i][j][0]

      if v>=N*M:

        continue

      if i+M==v:

        S[i//M][i%M]='v'

        S[i//M+1][i%M]='^'

      elif i-M==v:

        S[i//M-1][i%M]='v'

        S[i//M][i%M]='^'

      elif i+1==v:

        S[i//M][i%M]='>'

        S[i//M][i%M+1]='<'

      elif i-1==v:

        S[i//M][i%M-1]='>'

        S[i//M][i%M]='<'

for i in range(N):

  print((''.join(S[i])))
N, M = list(map(int, input().split()))
S = [list(eval(input())) for i in range(N)]
V = N * M
G = [[] for i in range(V)]
ma = [0] * V
us = [0] * V


def ae(u, v):
    G[u].append(v)
    G[v].append(u)


def df(v):
    us[v] = 1
    for i in range(len(G[v])):
        u = G[v][i]
        w = ma[u]
        if w < 0 or (not (us[w]) and df(w)):
            ma[v] = u
            ma[u] = v
            return 1
    return 0


def mat():
    r = 0
    for i in range(V):
        ma[i] = -1
    for v in range(V):
        if ma[v] < 0:
            for i in range(V):
                us[i] = 0
            if df(v):
                r += 1
    return r


w4y = [1, 0, -1, 0]
w4x = [0, 1, 0, -1]
for i in range(N):
    for j in range(M):
        if ((i + j + 1) & 1) and (S[i][j] == "."):
            for k in range(4):
                k = [i + w4y[k], j + w4x[k]]
                if min(k) < 0 or k[0] >= N or k[1] >= M:
                    continue
                if S[k[0]][k[1]] == ".":
                    ae(i * M + j, k[0] * M + k[1])
print((mat()))
for i in range(N):
    for j in range(M):
        if ma[i * M + j] < 0:
            continue
        if ma[i * M + j] == i * M + j + M:
            S[i][j] = "v"
        elif ma[i * M + j] == i * M + j - M:
            S[i][j] = "^"
        elif ma[i * M + j] == i * M + j + 1:
            S[i][j] = ">"
        elif ma[i * M + j] == i * M + j - 1:
            S[i][j] = "<"
    print(("".join(S[i])))

from collections import deque

N, M = list(map(int, input().split()))
S = [list(eval(input())) for i in range(N)]
V = N * M + 2
G = [[] for i in range(V)]
L = [0] * V
I = [0] * V
INF = 10**15


def ae(fr, to, ca):
    global G
    G[fr].append([to, ca, len(G[to]), 0])
    G[to].append([fr, 0, len(G[fr]) - 1, 0])


def bfs(s):
    global INF, L, V, G
    L = [-1] * V
    Q = deque()
    L[s] = 0
    Q.append(s)
    while len(Q):
        x = Q.popleft()
        for i in range(len(G[x])):
            if G[x][i][1] > 0 and L[G[x][i][0]] < 0:
                L[G[x][i][0]] = L[x] + 1
                Q.append(G[x][i][0])


def dfs(v, t, f):
    global I, G, V
    if v == t:
        return f
    for i in range(I[v], len(G[v])):
        if G[v][i][1] > 0 and L[v] < L[G[v][i][0]]:
            d = dfs(G[v][i][0], t, min(f, G[v][i][1]))
            if d > 0:
                G[v][i][1] -= d
                G[v][i][3] += d
                G[G[v][i][0]][G[v][i][2]][1] += d
                G[G[v][i][0]][G[v][i][2]][3] -= d
                return d
        I[v] += 1
    return 0


def mf(s, t):
    global L, I, INF, V
    fl = 0
    while True:
        bfs(s)
        if L[t] < 0:
            break
        I = [0] * V
        f = 0
        while True:
            f = dfs(s, t, INF)
            if f <= 0:
                break
            fl += f
    return fl


w4x = [0, 1, 0, -1]
w4y = [1, 0, -1, 0]
v = 0
for i in range(N):
    for j in range(M):
        if (i + j) & 1:
            ae(i * M + j, V - 1, 1)
            continue
        ae(V - 2, i * M + j, 1)
        if S[i][j] == "#":
            continue
        for k in range(4):
            v = [i + w4y[k], j + w4x[k]]
            if min(v) < 0 or v[0] == N or v[1] == M:
                continue
            if S[v[0]][v[1]] == ".":
                ae(i * M + j, v[0] * M + v[1], 1)
print((mf(V - 2, V - 1)))
for i in range(N * M):
    for j in range(len(G[i])):
        if G[i][j][3] > 0:
            v = G[i][j][0]
            if v >= N * M:
                continue
            if i + M == v:
                S[i // M][i % M] = "v"
                S[i // M + 1][i % M] = "^"
            elif i - M == v:
                S[i // M - 1][i % M] = "v"
                S[i // M][i % M] = "^"
            elif i + 1 == v:
                S[i // M][i % M] = ">"
                S[i // M][i % M + 1] = "<"
            elif i - 1 == v:
                S[i // M][i % M - 1] = ">"
                S[i // M][i % M] = "<"
for i in range(N):
    print(("".join(S[i])))

+from collections import deque + -V = N * M +V = N * M + 2 -ma = [0] * V -us = [0] * V +L = [0] * V +I = [0] * V +INF = 10**15 -def ae(u, v): -    G[u].append(v) -    G[v].append(u) +def ae(fr, to, ca): +    global G +    G[fr].append([to, ca, len(G[to]), 0]) +    G[to].append([fr, 0, len(G[fr]) - 1, 0]) -def df(v): -    us[v] = 1 -    for i in range(len(G[v])): -        u = G[v][i] -        w = ma[u] -        if w < 0 or (not (us[w]) and df(w)): -            ma[v] = u -            ma[u] = v -            return 1 +def bfs(s): +    global INF, L, V, G +    L = [-1] * V +    Q = deque() +    L[s] = 0 +    Q.append(s) +    while len(Q): +        x = Q.popleft() +        for i in range(len(G[x])): +            if G[x][i][1] > 0 and L[G[x][i][0]] < 0: +                L[G[x][i][0]] = L[x] + 1 +                Q.append(G[x][i][0]) + + +def dfs(v, t, f): +    global I, G, V +    if v == t: +        return f +    for i in range(I[v], len(G[v])): +        if G[v][i][1] > 0 and L[v] < L[G[v][i][0]]: +            d = dfs(G[v][i][0], t, min(f, G[v][i][1])) +            if d > 0: +                G[v][i][1] -= d +                G[v][i][3] += d +                G[G[v][i][0]][G[v][i][2]][1] += d +                G[G[v][i][0]][G[v][i][2]][3] -= d +                return d +        I[v] += 1 -def mat(): -    r = 0 -    for i in range(V): -        ma[i] = -1 -    for v in range(V): -        if ma[v] < 0: -            for i in range(V): -                us[i] = 0 -            if df(v): -                r += 1 -    return r +def mf(s, t): +    global L, I, INF, V +    fl = 0 +    while True: +        bfs(s) +        if L[t] < 0: +            break +        I = [0] * V +        f = 0 +        while True: +            f = dfs(s, t, INF) +            if f <= 0: +                break +            fl += f +    return fl +w4x = [0, 1, 0, -1] -w4x = [0, 1, 0, -1] +v = 0 -        if ((i + j + 1) & 1) and (S[i][j] == "."): -            for k in range(4): -                k = [i + w4y[k], j + w4x[k]] -                if min(k) < 0 or k[0] >= N or k[1] >= M: -                    continue -                if S[k[0]][k[1]] == ".": -                    ae(i * M + j, k[0] * M + k[1]) -print((mat())) +        if (i + j) & 1: +            ae(i * M + j, V - 1, 1) +            continue +        ae(V - 2, i * M + j, 1) +        if S[i][j] == "#": +            continue +        for k in range(4): +            v = [i + w4y[k], j + w4x[k]] +            if min(v) < 0 or v[0] == N or v[1] == M: +                continue +            if S[v[0]][v[1]] == ".": +                ae(i * M + j, v[0] * M + v[1], 1) +print((mf(V - 2, V - 1))) +for i in range(N * M): +    for j in range(len(G[i])): +        if G[i][j][3] > 0: +            v = G[i][j][0] +            if v >= N * M: +                continue +            if i + M == v: +                S[i // M][i % M] = "v" +                S[i // M + 1][i % M] = "^" +            elif i - M == v: +                S[i // M - 1][i % M] = "v" +                S[i // M][i % M] = "^" +            elif i + 1 == v: +                S[i // M][i % M] = ">" +                S[i // M][i % M + 1] = "<" +            elif i - 1 == v: +                S[i // M][i % M - 1] = ">" +                S[i // M][i % M] = "<" -    for j in range(M): -        if ma[i * M + j] < 0: -            continue -        if ma[i * M + j] == i * M + j + M: -            S[i][j] = "v" -        elif ma[i * M + j] == i * M + j - M: -            S[i][j] = "^" -        elif ma[i * M + j] == i * M + j + 1: -            S[i][j] = ">" -        elif ma[i * M + j] == i * M + j - 1: -            S[i][j] = "<"