#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

class Edge
{
public:
    int to, cap, rev, flow;
    Edge(int to = -1, int cap = 0, int rev = -1, int flow = 0)
    {
        this->to = to;
        this->cap = cap;
        this->rev = rev;
        this->flow = flow;
    }
};

int maxFlow(vector<vector<Edge> >& edges_org, int source, int sink)
{
    static vector<vector<Edge> > edges;
    static vector<bool> used;

    class Func{
    public:
        static int dfs(int s, int t, int f){
            if(s == t)
                return f;
            used[s] = true;
            for(unsigned i=0; i<edges[s].size(); ++i){
                Edge& e = edges[s][i];
                if(!used[e.to] && e.cap - e.flow > 0){
                    int g = dfs(e.to, t, min(f, e.cap - e.flow));
                    if(g > 0){
                        e.flow += g;
                        edges[e.to][e.rev].flow -= g;
                        return g;
                    }
                }
            }
            return 0;
        }
    };

    if(source == sink)
        return INT_MAX;

    int n = edges_org.size();
    edges.assign(n, vector<Edge>());
    for(int i=0; i<n; ++i){
        for(unsigned j=0; j<edges_org[i].size(); ++j){
            const Edge& e = edges_org[i][j];
            edges[i].push_back(Edge(e.to, e.cap, edges[e.to].size()));
            edges[e.to].push_back(Edge(i, 0, edges[i].size()-1));
        }
    }

    int ans = 0;
    for(;;){
        used.assign(n, false);
        int f = Func::dfs(source, sink, INT_MAX);
        if(f == 0)
            break;
        ans += f;
    }

    for(int i=0; i<n; ++i){
        for(unsigned j=0; j<edges_org[i].size(); ++j){
            edges_org[i][j].flow = edges[i][j].flow;
        }
    }

    return ans;
}

int bipartiteMaximumMatchings(const vector<vector<bool> >& graph, vector<vector<int> >& select)
{
    int h = graph.size();
    int w = graph[0].size();

    int source = h + w;
    int sink = h + w + 1;
    vector<vector<Edge> > edges(h+w+2);
    for(int y=0; y<h; ++y){
        edges[source].push_back(Edge(y, 1));
        for(int x=0; x<w; ++x){
            if(graph[y][x])
                edges[y].push_back(Edge(h + x, 1));
        }
    }
    for(int x=0; x<w; ++x){
        edges[h+x].push_back(Edge(sink, 1));
    }

    int ans = maxFlow(edges, source, sink);
    select.resize(2);
    select[0].assign(h, -1);
    select[1].assign(w, -1);
    for(int y=0; y<h; ++y){
        for(const Edge& e : edges[y]){
            if(e.flow == 1){
                int x = e.to - h;
                select[0][y] = x;
                select[1][x] = y;
            }
        }
    }

    return ans;
}

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

int solve(vector<string>& s)
{
    int h = s.size();
    int w = s[0].size();

    int n = h * w / 2;
    vector<vector<bool> > graph(n, vector<bool>(n, false));
    for(int y=0; y<h; ++y){
        for(int x=0; x<w; ++x){
            if(s[y][x] == '#' || (y + x) % 2 != 0)
                continue;

            for(int i=0; i<4; ++i){
                int y2 = y + dy[i];
                int x2 = x + dx[i];
                if(!(0 <= y2 && y2 < h && 0 <= x2 && x2 < w) || s[y2][x2] == '#')
                    continue;

                int a = y * (w / 2) + (x / 2);
                int b = y2 * (w / 2) + (x2 / 2);
                graph[a][b] = true;
            }
        }
    }

    vector<vector<int> > select;
    int ans = bipartiteMaximumMatchings(graph, select);
    for(int y=0; y<h; ++y){
        for(int x=0; x<w; ++x){
            int i = (y + x) % 2;
            int j = y * (w / 2) + (x / 2);
            if(select[i][j] == -1)
                continue;

            if(select[i][j] == j - (w / 2))
                s[y][x] = '^';
            else if(select[i][j] == j + (w / 2))
                s[y][x] = 'v';
            else if((select[i][j] == j) ^ (i == 0) ^ (y % 2 == 0))
                s[y][x] = '>';
            else
                s[y][x] = '<';
        }
    }

    return ans;
}

int main()
{
    int h, w;
    cin >> h >> w;

    vector<string> s(h);
    for(int y=0; y<h; ++y){
        cin >> s[y];
        s[y].resize((w+1)/2*2, '#');
    }

    int ans = solve(s);
    cout << ans << endl;
    for(int y=0; y<h; ++y)
        cout << s[y].substr(0, w) << endl;

    return 0;
}


Measured memory_bytes: 10060