#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <limits>

template <class Cap, bool isDirect>
struct MaxFlow {
    struct Edge {
        int src, dst;
        Cap cap;
        Edge(int src, int dst, Cap cap)
            : src(src), dst(dst), cap(cap){};
    };

    using Edges = std::vector<Edge>;
    using Graph = std::vector<std::vector<int>>;

    Edges edges;
    Graph graph;
    std::vector<int> dist, iter;

    explicit MaxFlow(int n)
        : graph(n), dist(n), iter(n) {}

    void span(int u, int v, Cap cap) {
        graph[u].push_back(edges.size());
        edges.emplace_back(u, v, cap);

        graph[v].push_back(edges.size());
        edges.emplace_back(v, u, (isDirect ? 0 : cap));
    }

    void bfs(int s) {
        std::fill(dist.begin(), dist.end(), -1);
        dist[s] = 0;
        std::queue<int> que;
        que.push(s);

        while (!que.empty()) {
            int v = que.front();
            que.pop();

            for (int eidx : graph[v]) {
                const auto& edge = edges[eidx];

                if (edge.cap > 0 && dist[edge.dst] < 0) {
                    dist[edge.dst] = dist[v] + 1;
                    que.push(edge.dst);
                }
            }
        }
    }

    int dfs(int v, int g, Cap f) {
        if (v == g) return f;

        for (int& itr = iter[v]; itr < (int)graph[v].size(); ++itr) {
            int eidx = graph[v][itr];
            auto& edge = edges[eidx];

            if (edge.cap > 0 && dist[v] < dist[edge.dst]) {
                Cap df = dfs(edge.dst, g, std::min(f, edge.cap));

                if (df > 0) {
                    edge.cap -= df;
                    auto& redge = edges[eidx ^ 1];
                    redge.cap += df;
                    return df;
                }
            }
        }
        return 0;
    }

    Cap exec(int s, int g) {
        const Cap INF = std::numeric_limits<Cap>::max();

        Cap ret = 0;
        while (true) {
            bfs(s);
            if (dist[g] < 0) return ret;

            std::fill(iter.begin(), iter.end(), 0);
            while (true) {
                Cap flow = dfs(s, g, INF);
                if (flow == 0) break;
                ret += flow;
            }
        }
    }
};

const std::vector<std::pair<int, int>>
    dxys{{0, 1}, {0, -1}, {1, 0}, {-1, 0}};

void solve() {
    int n, m;
    std::cin >> n >> m;

    std::vector<std::string> ss(n);
    for (auto& s : ss) std::cin >> s;

    int s = n * m, g = s + 1;
    auto enc = [&](int x, int y) { return x * m + y; };
    auto dec = [&](int v) { return std::make_pair(v / m, v % m); };

    MaxFlow<int, true> graph(n * m + 2);
    for (int x = 0; x < n; ++x) {
        for (int y = 0; y < m; ++y) {
            if (ss[x][y] == '#') continue;

            if ((x + y) % 2 == 0) {
                graph.span(s, enc(x, y), 1);

                for (auto [dx, dy] : dxys) {
                    int nx = x + dx,
                        ny = y + dy;
                    if (nx < 0 || n <= nx ||
                        ny < 0 || m <= ny ||
                        ss[nx][ny] == '#') continue;
                    graph.span(enc(x, y), enc(nx, ny), 1);
                }
            } else {
                graph.span(enc(x, y), g, 1);
            }
        }
    }

    std::cout << graph.exec(s, g) << "\n";

    for (auto e : graph.edges) {
        if (e.cap == 1) continue;

        auto [sx, sy] = dec(e.src);
        auto [gx, gy] = dec(e.dst);
        if (sx >= n || gx >= n || (sx + sy) % 2 != 0) continue;

        if (sx > gx || sy > gy) {
            std::swap(sx, gx);
            std::swap(sy, gy);
        }

        if (sx != gx) {
            ss[sx][sy] = 'v';
            ss[gx][gy] = '^';
        } else {
            ss[sx][sy] = '>';
            ss[gx][gy] = '<';
        }
    }

    for (const auto& v : ss) std::cout << v << "\n";
}

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

    solve();

    return 0;
}


Measured memory_bytes: 4852