#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

using namespace std;
typedef long long ll;

const int INF =  100000000;

struct edge {int to, cap, rev;};

class FordFolkerson{
    public:
        FordFolkerson(int n){
            N = n;
            G = vector<vector<edge>>(n, vector<edge>());
            used = vector<bool>(n, false);
        }

        void add_edge(int from, int to, int cap){
            G[from].push_back((edge{to, cap, (int)G[to].size()}));
            G[to].push_back((edge{from, 0, (int)G[from].size()-1}));
        }

        int max_flow(int s, int t){
            int flow = 0;
            while(true){
                clear_used();
                int f = dfs(s, t, INF);
                if(f == 0){
                    break;
                }
                flow += f;
            }
            return flow;
        }

        vector<vector<edge>> G;
        vector<bool> used;
        int N;
        void clear_used(){
            for(int i = 0; i < N; i++) used[i] = false;
        }

        int dfs(int v, int t, int f){
            if(v == t) return f;
            used[v] = true;
            for(int i = 0; i < G[v].size(); i++){
                edge &e = G[v][i];
                if(!used[e.to] && e.cap > 0){
                    int d = dfs(e.to, t, min(f, e.cap));
                    if(d > 0){
                        e.cap -= d;
                        G[e.to][e.rev].cap += d;
                        return d;
                    }
                }
            }
            return 0;
        }
};

int N, M;

int dh[4] = {0, 0, -1, 1};
int dw[4] = {-1, 1, 0, 0};

bool is_in_field(int i, int j){
    return i >= 0 && i < N && j >= 0 && j < M;
}

char s[100][100];
char ans[100][100];

int to_index(int i, int j){
    return i*M+j;
}

int to_i(int idx){
    return idx/M;
}

int to_j(int idx){
    return idx%M;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N >> M;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            cin >> s[i][j];
        }
    }
    FordFolkerson ff(2+N*M);
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            if(s[i][j] == '#') continue;
            if((i+j)%2 == 0){
                ff.add_edge(0, to_index(i, j)+1, 1);
                for(int k = 0; k < 4; k++){
                    int i_to = i+dh[k]; int j_to = j+dw[k];
                    if(!is_in_field(i_to, j_to)) continue;
                    if(s[i_to][j_to] == '#') continue;
                    ff.add_edge(to_index(i, j)+1, to_index(i_to, j_to)+1, 1);
                }
            }else{
                ff.add_edge(to_index(i, j)+1, N*M+1, 1);
            }
        }
    }
    cout <<  ff.max_flow(0, N*M+1) << endl;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            ans[i][j] = '.';
            if(s[i][j] == '#') ans[i][j] = '#';
        }
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            if((i+j)%2 == 1) continue;
            int idx = to_index(i, j);
            for(auto e : ff.G[idx+1]){
                if(e.cap == 0 && e.to != 0){
                    int to_idx = e.to-1;
                    int i_to = to_i(to_idx);
                    int j_to = to_j(to_idx);
                    if(i_to > i){
                        ans[i][j] =   'v';
                        ans[i+1][j] = '^';
                    }else if(i_to < i){
                        ans[i-1][j] = 'v';
                        ans[i][j] =   '^';
                    }else if(j_to > j){
                        ans[i][j] = '>'; ans[i][j+1] = '<';
                    }else{
                        ans[i][j-1] = '>'; ans[i][j] = '<';
                    }
                }
            }
        }
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            cout << ans[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 5644