#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;

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

template<class T>
T maxFlow(vector<vector<EdgeBase<T> > >& edges_org, int source, int sink)
{
    static const T INF = numeric_limits<T>::max();
    static const T EPS = static_cast<T>(1.0e-10);
    static vector<vector<EdgeBase<T> > > edges;
    static vector<unsigned> index;
    static vector<int> level;

    class Func{
    public:
        static void bfs(int s){
            int n = edges.size();
            level.assign(n, -1);
            queue<int> q;
            level[s] = 0;
            q.push(s);
            while(!q.empty()){
                int v = q.front();
                q.pop();
                for(auto& e : edges[v]){
                    if(e.cap - e.flow > EPS && level[e.to] < 0){
                        level[e.to] = level[v] + 1;
                        q.push(e.to);
                    }
                }
            }
        }
        static T dfs(int s, int t, T f){
            if(s == t)
                return f;
            for(auto& e : edges[s]){
                if(e.cap - e.flow > EPS && level[s] < level[e.to]){
                    T g = dfs(e.to, t, min(f, e.cap - e.flow));
                    if(g > EPS){
                        e.flow += g;
                        edges[e.to][e.rev].flow -= g;
                        return g;
                    }
                }
            }
            return 0;
        }
    };

    if(source == sink)
        return INF;

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

    T ans = 0;
    for(;;){
        Func::bfs(source);
        if(level[sink] < 0)
            break;
        index.assign(n, 0);
        for(;;){
            T f = Func::dfs(source, sink, INF);
            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: 9596