#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << __LINE__ << ' ' << #x << ':' << x << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
template<class T> using pque = priority_queue<T, vector<T>, greater<T>>;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr int mod1e9 = 1000000007;
constexpr int mod998 = 998244353;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
constexpr ll ten(int n) { return n ? 10 * ten(n - 1) : 1; };
int dx[] = { 1,0,-1,0,1,1,-1,-1 }; int dy[] = { 0,1,0,-1,1,-1,1,-1 };
void fail() { cout << "-1\n"; exit(0); }
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }
template<class T> istream &operator >> (istream &s, vector<T> &v) { for (auto &e : v) s >> e; return s; }
template<class T> ostream &operator << (ostream &s, const vector<T> &v) { for (auto &e : v) s << e << ' '; return s; }

struct fastio {
	fastio() {
		cin.tie(0); cout.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(20);
		cerr << fixed << setprecision(20);
	}
}fastio_;

template<class T> class Dinic {
	struct edge {
		int to;
		T cap, icap;
		int rev;
	};
	vector<vector<edge>> graph;
	vector<int> level, iter;
public:
	Dinic(int n) {
		graph = vector<vector<edge>>(n, vector<edge>());
		level = iter = vector<int>(n);
	}
	void add_edge(int from, int to, T cap) {
		graph[from].push_back({ to,cap,cap,(int)graph[to].size() });
		graph[to].push_back({ from,0,0,(int)graph[from].size() - 1 });
	}
	void bfs(int s) {
		for (int &i : level) i = -1;
		queue<int> que;
		level[s] = 0;
		que.push(s);
		while (!que.empty()) {
			int v = que.front(); que.pop();
			for (int i = 0; i < graph[v].size(); i++) {
				edge &e = graph[v][i];
				if (e.cap > 0 && level[e.to] < 0) {
					level[e.to] = level[v] + 1;
					que.push(e.to);
				}
			}
		}
	}
	T dfs(int v, int t, T f) {
		if (v == t) return f;
		for (int &i = iter[v]; i < graph[v].size(); i++) {
			edge &e = graph[v][i];
			if (e.cap > 0 && level[v] < level[e.to]) {
				T d = dfs(e.to, t, min(f, e.cap));
				if (d > 0) {
					e.cap -= d;
					graph[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}
	T max_flow(int s, int t) {
		T flow = 0;
		while (true) {
			bfs(s);
			if (level[t] < 0) return flow;
			for (int &i : iter) i = 0;
			T f = 0;
			while ((f = dfs(s, t, inf)) > 0) flow += f;
		}
	}
	vector<P> bipartite_matching(int s, int t) {
		vector<P> res;
		max_flow(s, t);
		for (int i = 0; i < graph.size(); i++) {
			if (i == s) continue;
			for (edge e : graph[i]) {
				if (e.cap == 0 && e.icap == 1 && e.to != t) {
					res.push_back({ i,e.to });
				}
			}
		}
		return res;
	}
};

int main() {
	int n, m;
	cin >> n >> m;
	vector<string> s(n);
	cin >> s;
	Dinic<int> d(n * m + 2);
	rep(i, n) {
		rep(j, m - 1) {
			if (s[i][j] == '.' && s[i][j + 1] == '.') {
				if (i % 2 == j % 2) d.add_edge(i * m + j, i * m + j + 1, 1);
				else d.add_edge(i * m + j + 1, i * m + j, 1);
			}
		}
	}
	rep(j, m) {
		rep(i, n - 1) {
			if (s[i][j] == '.' && s[i + 1][j] == '.') {
				if (i % 2 == j % 2) d.add_edge(i * m + j, i * m + j + m, 1);
				else d.add_edge(i * m + j + m, i * m + j, 1);
			}
		}
	}
	rep(i, n) {
		rep(j, m) {
			if (i % 2 == j % 2) d.add_edge(n * m, i * m + j, 1);
			else d.add_edge(i * m + j, n * m + 1, 1);
		}
	}
	vector<P> match = d.bipartite_matching(n * m, n * m + 1);
	for (P p : match) {
		int a = p.first; int b = p.second;
		int ay = a % m; int ax = (a - ay) / m;
		int by = b % m; int bx = (b - by) / m;
		if (ax == bx) {
			if (ay < by) s[ax][ay] = '>', s[bx][by] = '<';
			else s[ax][ay] = '<', s[bx][by] = '>';
		}
		else {
			if (ax < bx) s[ax][ay] = 'v', s[bx][by] = '^';
			else s[ax][ay] = '^', s[bx][by] = 'v';
		}
	}
	cout << match.size() << '\n';
	rep(i, n) cout << s[i] << '\n';
}

Measured memory_bytes: 5516