#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template<typename flow_t>
struct Dinic{
    const flow_t INF;

    struct Edge{
        int to;
        flow_t cap;
        int rev;
        bool isrev;
        Edge(int to, flow_t cap, int rev, bool isrev) : to(to), cap(cap), rev(rev), isrev(isrev) {}
    };

    vector<vector<Edge>> graph;
    vector<int> min_cost;       // sからの距離(bfsで調べる)
    vector<int> iter;           // どこまで調べ終わったか(dfs時に使用)

    Dinic(int V) : INF(numeric_limits<flow_t>::max() / 2){
        graph.resize(V);
    }

    void add_edge(int from, int to, flow_t cap){
        graph[from].push_back(Edge(to, cap, graph[to].size(), false));
        graph[to].push_back(Edge(from, 0, graph[from].size() - 1, true));
    }

    // 最短路探索
    bool bfs(int s, int t){
        min_cost.assign(graph.size(), -1);
        queue<int> que;
        min_cost[s] = 0;
        que.push(s);
        while(!que.empty() && min_cost[t] == -1){
            int p = que.front();
            que.pop();
            for(auto &e : graph[p]){
                if(e.cap > 0 && min_cost[e.to] == -1){
                    min_cost[e.to] = min_cost[p] + 1;
                    que.push(e.to);
                }
            }
        }
        return min_cost[t] != -1;
    }

    flow_t dfs(int v, int t, flow_t flow){
        if(v == t)  return flow;
        for(int &i = iter[v]; i < graph[v].size(); ++i){
            Edge &e = graph[v][i];
            if(e.cap > 0 && min_cost[v] < min_cost[e.to]){
                flow_t d = dfs(e.to, t, min(flow, e.cap));
                if(d > 0){
                    e.cap -= d;
                    graph[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }

    flow_t max_flow(int s, int t){
        flow_t flow = 0;
        // 最短路を求めて、そのパスに最大流を流す
        while(bfs(s, t)){
            iter.assign(graph.size(), 0);
            flow_t f = 0;
            while((f = dfs(s, t, INF)) > 0) flow += f;
        }
        return flow;
    }
};

constexpr int dx[4] = {1, 0, -1, 0};
constexpr int dy[4] = {0, 1, 0, -1};

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

    int N, M;
    cin >> N >> M;
    Dinic<int> dinic(N * M + 2);
    int s = N * M, t = N * M + 1;
    vector<vector<char>> c(N, vector<char>(M));
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < M; ++j){
            cin >> c[i][j];
            if(c[i][j] == '#')  continue;
            int v = M * i + j;
            if((i + j) & 1) dinic.add_edge(v, t, 1);
            else    dinic.add_edge(s, v, 1);
        }
    }
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < M; ++j){
            if(c[i][j] == '#' || (i + j) & 1)   continue;
            int u = M * i + j;
            for(int k = 0; k < 4; ++k){
                int ni = i + dx[k], nj = j + dy[k];
                if(ni < 0 || ni >= N || nj < 0 || nj >= M)  continue;
                if(c[ni][nj] == '#')    continue;
                int v = M * ni + nj;
                dinic.add_edge(u, v, 1);
            }
        }
    }
    cout << dinic.max_flow(s, t) << '\n';
    auto& graph = dinic.graph;
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < M; ++j){
            if(c[i][j] == '#' || (i + j) & 1)   continue;
            int u = M * i + j;
            for(auto& e : graph[u]){
                if(graph[e.to][e.rev].cap){
                    int v = e.to;
                    if(v == s || v == t)    continue;
                    int ni = v / M, nj = v % M;
                    if(ni == i + 1){
                        c[i][j] = 'v';
                        c[ni][nj] = '^';
                    }
                    else if(ni == i - 1){
                        c[ni][nj] = 'v';
                        c[i][j] = '^';
                    }
                    else if(nj == j + 1){
                        c[i][j] = '>', c[ni][nj] = '<';
                    }
                    else{
                        c[ni][nj] = '>', c[i][j] = '<';
                    }
                    break;
                }
            }
        }
    }
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < M; ++j){
            cout << c[i][j];
        } cout << '\n';
    }
}

Measured memory_bytes: 5284