#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

// ----------------------------------------------------------------------
// ----------------------------------------------------------------------

struct FordFulkerson {
  struct edge { ll to, cap, rev, idx; bool isrev; };
  vector<vector<edge>> adj;
  vector<ll> used;
  ll timestamp;
  FordFulkerson(ll n) : timestamp(0) { adj.resize(n); used.resize(n,-1); }
  void add_edge(ll from, ll to, ll cap, ll idx = -1) {
    adj[from].push_back({to, cap, (ll)adj[to].size(), idx, false});
    adj[to].push_back({from, 0, (ll)adj[from].size()-1, idx, true});
  }
  ll dfs(ll now, ll to, ll flow) {
    if (now==to) return flow;
    used[now] = timestamp;
    for (auto &x: adj[now]) {
      if (x.cap>0 && used[x.to]!=timestamp) {
        ll d = dfs(x.to, to, min(flow, x.cap));
        if (d>0) {
          x.cap -= d;
          adj[x.to][x.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }
  ll max_flow(ll from, ll to) {
    ll result = 0;
    for (ll f; (f=dfs(from,to,LLINF))>0; timestamp++) result += f;
    return result;
  }
};

// ----------------------------------------------------------------------
// ----------------------------------------------------------------------

int main() {
  ll N, M; cin >> N >> M;
  string S[N]; rep(i,N) cin >> S[i];

  FordFulkerson ff(N*M+2);
  rep(i,N) rep(j,M) {
    if (S[i][j]=='.') {
      if ((i+j)%2==0) {
        ff.add_edge(0, i*M+j+1, 1);
        if (i!=N-1&&S[i+1][j]=='.') ff.add_edge(i*M+j+1, (i+1)*M+j+1, 1);
        if (j!=M-1&&S[i][j+1]=='.') ff.add_edge(i*M+j+1, i*M+(j+1)+1, 1);
        if (i!=0  &&S[i-1][j]=='.') ff.add_edge(i*M+j+1, (i-1)*M+j+1, 1);
        if (j!=0  &&S[i][j-1]=='.') ff.add_edge(i*M+j+1, i*M+(j-1)+1, 1);
      }
      else ff.add_edge(i*M+j+1, N*M+1, 1);
    }
  }

  ll sum = ff.max_flow(0,N*M+1);
  string result[N]; rep(i,N) result[i] = S[i];

  for (auto &x: ff.adj[0]) {
    if (x.cap==0) {
      ll xh = (x.to-1)/M, xw = (x.to-1)%M;
      for (auto &y: ff.adj[x.to]) {
        ll yh = (y.to-1)/M, yw = (y.to-1)%M;
        if (!y.isrev && y.cap==0) {
          if (xw!=M-1 && y.to==x.to+1) {
            result[xh][xw] = '>';
            result[yh][yw] = '<';
          } 
          else if (xh!=N-1 && y.to==x.to+M) {
            result[xh][xw] = 'v';
            result[yh][yw] = '^';
          }
          else if (yw!=M-1 && y.to==x.to-1) {
            result[xh][xw] = '<';
            result[yh][yw] = '>';
          } 
          else if (yh!=N-1 && y.to==x.to-M) {
            result[xh][xw] = '^';
            result[yh][yw] = 'v';
          }
        }
      }
    }
  }

  cout << sum << endl;
  rep(i,N) cout << result[i] << endl;

  return 0;
}

Measured memory_bytes: 7440