#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
//const int MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const double pi = acos(-1.0);
const double EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

template<typename T>
struct Max_Flow{
    struct edge{
        int to; T cap; int rev;
        edge(int to, T cap, int rev) : to(to), cap(cap), rev(rev) {}
    };

    vector<vector<edge>> es;
    vector<bool> used;
    const T INF_T;
    const int n;

    Max_Flow(int n) : INF_T(numeric_limits<T>::max()), n(n){
        es.resize(n), used.resize(n);
    }

    void add_edge(int from, int to, T cap, bool directed = true){
        es[from].eb(to, cap, sz(es[to]));
        es[to].eb(from, directed? 0 : cap, sz(es[from])-1);
    }

    T dfs(int now, int t, T flow){
        if(now == t) return flow;
        used[now] = true;
        for(auto &e: es[now]){
            if(!used[e.to] && e.cap > 0){
                T f = dfs(e.to, t, min(flow, e.cap));
                if(f > 0){
                    e.cap -= f;
                    es[e.to][e.rev].cap += f;
                    return f;
                }
            }
        }
        return 0;
    }

    T max_flow(int s, int t){
        T flow = 0;
        for(;;){
            fill(all(used), false);
            T f = dfs(s, t, INF_T);
            if(f == 0) return flow;
            flow += f;
        }
    }
};

int main(){
    int H, W;
    cin >> H >> W;
    int N = H*W;
    string S[H];
    rep(i, H) cin >> S[i];
    Max_Flow<int> G(2*N+2);
    int s = 2*N, t = 2*N+1;
    int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
    rep(i, H){
        rep(j, W){
            if(S[i][j] == '#') continue;
            if((i+j)&1){
                G.add_edge(N+W*i+j, t, 1);
                continue;
            }
            G.add_edge(s, W*i+j, 1);
            rep(k, 4){
                int ni = i+dx[k], nj = j+dy[k];
                if(ni < 0 || ni >= H || nj < 0 || nj >= W || S[ni][nj] == '#') continue;
                G.add_edge(W*i+j, N+W*ni+nj, 1);
            }
        }
    }
    cout << G.max_flow(s, t) << endl;
    rep(i, N){
        for(auto &e: G.es[i]){
            if(e.to == s) continue;
            if(e.cap == 1) continue;
            int j = e.to-N;
            if(j == i+1) S[i/W][i%W] = '>', S[j/W][j%W] = '<';
            if(j == i-1) S[i/W][i%W] = '<', S[j/W][j%W] = '>';
            if(j == i+W) S[i/W][i%W] = 'v', S[j/W][j%W] = '^';
            if(j == i-W) S[i/W][i%W] = '^', S[j/W][j%W] = 'v';
        }
    }
    rep(i, H) cout << S[i] << endl;
}

Measured memory_bytes: 5380