#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#include <atcoder/all>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    V<string> grid(N);
    REP(i, 0, N) {
        cin >> grid[i];
    }
    mf_graph<ll> g(N * M + 2);
    ll s = N * M;
    ll t = N * M + 1;
    REP(i, 0, N) {
        REP(j, 0, M) {
            if (grid[i][j] == '#') {
                continue;
            }
            ll v = i * M + j;
            if ((i + j) % 2 == 0) {
                g.add_edge(s, v, 1);
            } else {
                g.add_edge(v, t, 1);
            }
        }
    }
    REP(i, 0, N) {
        REP(j, 0, M) {
            if ((i + j) % 2 == 1 || grid[i][j] == '#') {
                continue;
            }
            ll v = i * M + j;
            REP(k, 0, 4) {
                ll ib = i + dx[k];
                ll jb = j + dy[k];
                if (ib < 0 || ib == N || jb < 0 || jb == M) {
                    continue;
                }
                if (grid[ib][jb] == '#') {
                    continue;
                }
                ll vb = ib * M + jb;
                g.add_edge(v, vb, 1);
            }
        }
    }
    cout << g.flow(s, t) << endl;
    auto edges = g.edges();
    for (auto e : edges) {
        if (e.from == s || e.to == t || e.flow == 0) {
            continue;
        }
        ll i0 = e.from / M;
        ll j0 = e.from % M;
        ll i1 = e.to / M;
        ll j1 = e.to % M;
        if (i0 == i1 + 1) {
            grid[i1][j1] = 'v';
            grid[i0][j0] = '^';
        } else if (j0 == j1 + 1) {
            grid[i1][j1] = '>';
            grid[i0][j0] = '<';
        } else if (i0 == i1 - 1) {
            grid[i1][j1] = '^';
            grid[i0][j0] = 'v';
        } else {
            grid[i1][j1] = '<';
            grid[i0][j0] = '>';
        }
    }
    REP(i, 0, N) {
        cout << grid[i] << endl;
    }
}


Measured memory_bytes: 6132