#include <bits/stdc++.h>
using namespace std;

struct Dinic{
    struct edge {
        int64_t to, cap, rev;
        edge(int64_t to, int64_t cap, int64_t rev):to(to), cap(cap), rev(rev){}
    };

    int N, S, T;
    int64_t flow = 0;
    const int64_t INF = 1e18;
    vector<int> level, iter;
    vector<vector<edge>> G;

    Dinic(int N, int S, int T):N(N), S(S), T(T){
        flow = 0;
        level.resize(N);
        iter.resize(N);
        G.resize(N);
    }

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

    void bfs(int s){
        fill(level.begin(), level.end(), -1);
        queue<int> que;
        level[s] = 0;
        que.push(s);
        while(que.size()){
            int v = que.front(); que.pop();
            for(auto& e : G[v]){
                if(e.cap > 0 && level[e.to] < 0){
                    level[e.to] = level[v] + 1;
                    que.push(e.to);
                }
            }
        }
    }

    int64_t dfs(int v, int t, int64_t f){
        if(v == t) return f;
        for(int& i=iter[v]; i<(int)G[v].size(); i++){
            auto& e = G[v][i];
            if(e.cap > 0 && level[v] < level[e.to]){
                int64_t 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;
    }

    int64_t max_flow(){
        while(true){
            bfs(S);
            if(level[T] < 0) return flow;
            fill(iter.begin(), iter.end(), 0);
            while(true){
                int64_t f = dfs(S, T, INF);
                if(f == 0) break;
                flow += f;
            }
        }
    }
};

int main(){
    int N, M;
    cin >> N >> M;
    string S[100], ans[100];
    for(int i=0; i<N; i++){
        cin >> S[i];
        ans[i] = S[i];
    }

    auto encode = [&](int i, int j){ return i*M+j; };
    auto decode = [&](int v){ return make_pair(v/M, v%M); };
    auto inside = [&](int i, int j){ return 0<=i && i<N && 0<=j && j<M; };
    int dx[] = {0, 0, -1, 1};
    int dy[] = {-1, 1, 0, 0};

    int SS = N*M;
    int TT = SS+1;
    Dinic solver(TT+1, SS, TT);
    for(int i=0; i<N; i++) for(int j=0; j<M; j++) if(S[i][j] == '.'){
        if((i+j)%2){
            solver.add_edge(SS, encode(i, j), 1);
            for(int k=0; k<4; k++){
                int x = i+dx[k], y = j+dy[k];
                if(inside(x, y) && S[x][y] == '.') solver.add_edge(encode(i, j), encode(x, y), 1);
            }
        }else{
            solver.add_edge(encode(i, j), TT, 1);
        }
    }
    int opt = solver.max_flow();

    for(int i=0; i<N; i++) for(int j=0; j<M; j++) if((i+j)%2){
        int s = encode(i, j);
        for(auto& e : solver.G[s]) if(e.to < N*M && e.cap == 0){
            auto [i, j] = decode(s);
            auto [x, y] = decode(e.to);
            if(y-j==-1){
                ans[i][j] = '<';
                ans[x][y] = '>';
            }else if(y-j==1){
                ans[i][j] = '>';
                ans[x][y] = '<';
            }else if(i-x==-1){
                ans[i][j] = 'v';
                ans[x][y] = '^';
            }else if(i-x==1){
                ans[i][j] = '^';
                ans[x][y] = 'v';
            }
        }
    }    

    cout << opt << endl;
    for(int i=0; i<N; i++) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 5828