//#pragma warning(disable:4996)
//#include <Windows.h>
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
//#include <stdio.h>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<int, int> PI;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef unsigned long long ULL;
template<class T>
using pqueue = priority_queue<T, vector<T>, function<bool(T, T)>>;

template<class T>
inline void chmin(T& a, T b) {
	a = min(a, b);
}

template<class T>
inline void chmax(T& a, T b) {
	a = max(a, b);
}

void input();
void solve();

void daminput();
void naive();

void outputinput();

int main() {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	input();
	//daminput();
	solve();
	//naive();
	//outputinput();
	return 0;
}

//////////////////////////////////////////////////
//////////////////////////////////////////////////

int N, M;
vector<string> S;

void input() {
	cin >> N >> M;
	S.resize(N);
	for (int n = 0; n < N; n++) {
		cin >> S[n];
	}
}

void daminput() {
}

template<class F>
class MaxFEdge {
public:
	int to;
	F cap;
	int rev;
	MaxFEdge(int _to, F _cap, int _rev) :to(_to), cap(_cap), rev(_rev) {}
};

template<class F>
class Dinic {
public:
	int V;
	vector<vector<MaxFEdge<F>>> G;
	VI itr, level;
	Dinic(int _v) :V(_v) {
		G.resize(V);
	}
	void AddEdge(int src, int to, F cap) {
		G[src].push_back(MaxFEdge<F>(to, cap, G[to].size()));
		G[to].push_back(MaxFEdge<F>(src, 0, G[src].size() - 1));
	}
	void bfs(int s) {
		level.assign(V, -1);
		queue<int> q;
		level[s] = 0;
		q.push(s);
		while (!q.empty()) {
			int v = q.front();
			q.pop();
			for (auto& e : G[v]) {
				if (e.cap > 0 && level[e.to] < 0) {
					level[e.to] = level[v] + 1;
					q.push(e.to);
				}
			}
		}
	}
	F dfs(int v, int t, F f) {
		if (v == t)return f;
		F res = 0;
		for (int& i = itr[v]; i < (int)G[v].size(); i++) {
			MaxFEdge<F>& e = G[v][i];
			if (e.cap > 0 && level[v] < level[e.to]) {
				F d = dfs(e.to, t, min(f, e.cap));
				if (d > 0) {
					e.cap -= d;
					G[e.to][e.rev].cap += d;
					res += d;
					f -= d;
				}
			}
		}
		return res;
	}
	F MaxFlow(int s, int t) {
		F res = 0;
		F f = 0;
		F inf = numeric_limits<F>::max();
		while (true) {
			bfs(s);
			if (level[t] < 0)return res;
			itr.assign(V, 0);
			while (true) {
				f = dfs(s, t, inf);
				if (f <= 0)break;
				res += f;
			}
		}
	}
};

int vect[4][2] = {
	{1,0},{-1,0},{0,1},{0,-1}
};

void solve() {
	Dinic<int> D(N*M+2);
	auto conv = [&](int y, int x) {
		return y * M + x;
	};
	for (int y = 0; y < N; y++) {
		for (int x = 0; x < M; x++) {
			if (S[y][x] == '.') {
				if ((x + y) % 2 == 1) {
					D.AddEdge(conv(y, x), N * M + 1, 1);
				}
				else{
					D.AddEdge(N * M, conv(y, x), 1);
					for (int v = 0; v < 4; v++) {
						int ny = y + vect[v][0];
						int nx = x + vect[v][1];
						if (nx < 0 || nx >= M || ny < 0 || ny >= N)continue;
						if (S[ny][nx] == '#')continue;
						D.AddEdge(conv(y, x), conv(ny, nx), 1);
					}
				}
			}
		}
	}
	int maxflow = D.MaxFlow(N * M, N * M + 1);
	cout << maxflow << "\n";
	for (int y = 0; y < N; y++) {
		for (int x = 0; x < M; x++) {
			if (S[y][x] == '.') {
				if ((x + y) % 2 == 1) {
					continue;
				}
				else {
					for (auto& edge : D.G[conv(y, x)]) {
						if (edge.to == N * M)continue;
						if (edge.cap == 1)continue;
						int ny = edge.to / M;
						int nx = edge.to % M;
						if (ny == y + 1) {
							S[y][x] = 'v';
							S[ny][x] = '^';
						}
						else if (ny == y - 1) {
							S[y][x] = '^';
							S[ny][x] = 'v';
						}
						else if (nx == x + 1) {
							S[y][x] = '>';
							S[y][nx] = '<';
						}
						else {
							S[y][x] = '<';
							S[y][nx] = '>';
						}
					}
				}
			}
		}
	}
	for (int y = 0; y < N; y++) {
		cout << S[y] << "\n";
	}
}

void naive() {
}

void outputinput() {
}

Measured memory_bytes: 4460