#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
#include <ctime>
#include <complex>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 2020000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    for(auto itr = a.begin(); itr != a.end(); itr++){
		cout << *itr << " ";
	}
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){
	cout << "debug: " << a << " " << b << "\n";
}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << "debug: " << a << " " << b << " " << c << "\n";
}
void mark() {cout << "#" << "\n";}
ll pcount(ll x) {return __builtin_popcountll(x);}
const int mod = 1e9 + 7;
//const int mod = 998244353;

struct Dinic{
	struct edge{
		ll to, cap, rev;
	};
	vector<vector<edge>> G;
	vector<int> level, itr;
	ll n;
	const ll INF = 1<<30;
 
	Dinic(ll n) : n(n){
		G.resize(n);
		level.resize(n);
		itr.resize(n);
	}
 
	void add_edge(ll from, ll to, ll cap){
		G[from].push_back({to,cap,(ll)G[to].size()});
		G[to].push_back({from,0,(ll)G[from].size()-1});
	}
 
	void bfs(int s){
		fill(level.begin(), level.end(), -1);
		queue<int> q;
		level[s] = 0;
		q.push(s);
		while(!q.empty()){
			int u = q.front(); q.pop();
			for(auto &e : G[u]){
				if(e.cap > 0 && level[e.to] < 0){
					level[e.to] = level[u] + 1;
					q.push(e.to);
				}
			}
		}
	}

	ll dfs(int u, int t, ll f){
		if(u == t) return f;
		for(int &i = itr[u]; i < G[u].size(); i++){
			edge &e = G[u][i];
			if(e.cap > 0 && level[u] < level[e.to]){
				ll d = dfs(e.to, t, min(f, e.cap));
				if(d > 0){
					e.cap -= d;
					G[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}
 
	ll max_flow(ll s, ll t){
		ll flow = 0;
		while(1){
			bfs(s);
			if(level[t] < 0) return flow;
			fill(itr.begin(), itr.end(), 0);
			ll f;
			while((f = dfs(s, t, INF)) > 0){
				flow += f;
			}
		}
	}
};

bool in(ll y, ll x, ll h, ll w){
	return 0 <= y && y < h && 0 <= x && x < w;
}

int main(){
	int n,m; cin >> n >> m;
    vs s(n); rep(i,n) cin >> s[i];
    Dinic flow(n*m+2);
    int S = n*m, T = n*m+1;
    rep(i,n){
        rep(j,m){
            if(s[i][j] == '#') continue;
            if((i+j) & 1 ^ 1){
                flow.add_edge(S,i*m+j,1);
                rep(k,4){
                    int ny = i + dy[k];
                    int nx = j + dx[k];
                    if(in(ny,nx,n,m) && s[ny][nx] == '.'){
                        flow.add_edge(i*m+j,ny*m+nx,1);
                    }
                }
            }else{
                flow.add_edge(i*m+j,T,1);
            }
        }
    }
	cout << flow.max_flow(S,T) << "\n";
	vs t = s;
	rep(i,n*m){
		if((i/m+i%m) & 1) continue;
 		for(auto v : flow.G[i]){
			if(v.to == T || v.to == S) continue;
			if(v.cap == 0){
				int y = v.to / m;
				int x = v.to % m;
				if(y == i/m){
					if(x == i%m-1){
						t[y][x] = '>';
						t[i/m][i%m] = '<';
					}else{
						t[i/m][i%m] = '>';
						t[y][x] = '<';
					}
				}else{
					if(y == i/m-1){
						t[y][x] = 'v';
						t[i/m][i%m] = '^';
					}else{
						t[i/m][i%m] = 'v';
						t[y][x] = '^';
					}
				}
			}
		}
	}
	rep(i,n) cout << t[i] << "\n";
}

Measured memory_bytes: 5884