#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#include <numeric>
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
const double EPS = 1e-10;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

//ford-fulkerson
struct edge { ll to, cap, rev; };

const int MAX_V = 10101;
int used[MAX_V];
vector<edge>G[MAX_V];
int fl = 0;

ll dfs(ll v, ll t, ll f) {
	if (v == t)return f;
	used[v] = 1;
	for (int i = 0; i < G[v].size(); i++) {
		edge e = G[v][i];
		if (used[e.to] == 0 && e.cap > 0) {
			ll d = dfs(e.to, t, min(f, e.cap));
			if (d > 0) {
				G[v][i].cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

void add_edge(ll from, ll to, ll cap) {
	edge fe = { to,cap,(int)G[to].size() };
	edge toe = { from,0,(int)G[from].size() };
	G[from].pb(fe);
	G[to].pb(toe);
}

ll max_flow(int s, int t) {
	ll flow = 0;
	while (1) {
		memset(used, 0, sizeof(used));
		ll f = dfs(s, t, inf);
		if (f == 0)return flow;
		flow += f;
	}
}
//ford-fulkersonここまで

vector<string>S;
map<pair<int, int>, int>mp;
map<int, pair<int, int>>mprev;
int di[4] = { -1,0,1,0 };
int dj[4] = { 0,1,0,-1 };

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int N, M;
	cin >> N >> M;

	int s = 10010;
	int t = 10011;
	S.resize(N);

	int cnt = 0;
	for (int i = 0; i < N; i++)for (int j = 0; j < M; j++) {
		mp[{i, j}] = cnt;
		mprev[cnt] = { i,j };
		cnt++;
	}

	for (int i = 0; i < N; i++)cin >> S[i];

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			if ((i + j) % 4 == 0 || (i + j) % 4 == 2) {
				add_edge(mp[{i, j}], t, 1);
				continue;
			}
			else add_edge(s, mp[{i, j}], 1);

			if (S[i][j] == '#')continue;

			for (int k = 0; k < 4; k++) {
				int nxti = i + di[k];
				int nxtj = j + dj[k];
				if (0 <= nxti && nxti < N && 0 <= nxtj && nxtj < M) {
					if (S[nxti][nxtj] == '#')continue;
					add_edge(mp[{i, j}], mp[{nxti, nxtj}], 1);
				}
			}
		}
	}



	puts(max_flow(s, t));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			if ((i + j) % 4 == 0 || (i + j) % 4 == 2)continue;
			if (S[i][j] == '#')continue;

			int num = mp[{i, j}];
			for (int k = 0; k < G[num].size(); k++) {
				edge e = G[num][k];
				if (e.to == s)continue;
				if (e.cap == 0) {
					int toi = mprev[e.to].first;
					int toj = mprev[e.to].second;
					if (i - toi == -1) {
						S[i][j] = 'v';
						S[toi][toj] = '^';
					}
					else if (i - toi == 1) {
						S[i][j] = '^';
						S[toi][toj] = 'v';
					}
					else if (j - toj == -1) {
						S[i][j] = '>';
						S[toi][toj] = '<';
					}
					else if (j - toj == 1) {
						S[i][j] = '<';
						S[toi][toj] = '>';
					}
				}
			}
		}
	}


	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			cout << S[i][j];
		}
		puts("");
	}

	return 0;
}

Measured memory_bytes: 6744