#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;
typedef pair<int, int> pii;
// LatexBegin
struct Dinic { LL flow;
  struct Node : vector<int> { int d, p; };
  struct Edge { int u, v; LL c; };
  vector<Node> N; vector<Edge> E;
  void init(int n) {
    E.clear(); N.clear(); N.resize(n); flow = 0;
  }
  void addEdge(int u, int v, LL c) { int m = E.size();
    E.push_back({u, v, c}); N[u].push_back(m++);
    E.push_back({v, u, 0}); N[v].push_back(m++);
  }
  void run(int s, int t) {
    flow = 0; while (bfs(s, t)) flow += dfs(s,t,INF);
  }
  bool bfs(int s, int t) {
    for (auto &v : N) v.d = -1, v.p = 0;
    queue<int> q; q.push(s); N[s].d = 0;
    while (q.size()) { int u = q.front(); q.pop();
      for (auto &e : N[u]) { int v = E[e].v;
        if (!~N[v].d && E[e].c)
          q.push(v), N[v].d = N[u].d + 1;
      }
    }
    return ~N[t].d;
  }
  LL dfs(int u, int t, LL a) {
    if (u == t || !a) return a; LL flow = 0;
    for (int &p = N[u].p; p < N[u].size() ; p++) {
      auto e = N[u][p], v = E[e].v;
      if (N[u].d + 1 != N[v].d) continue;
      LL f = dfs(v, t, min(a, E[e].c));
      E[e].c -= f; E[e ^ 1].c += f; flow += f; a -= f;
      if (!a) break;
    }
    return flow;
  }
} solver;
// LatexEnd
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, m; cin >> n >> m;
    vector<vector<char>> G(n, vector<char>(m));
    for (auto &vv : G)
        for (auto &v : vv)
            cin >> v;
    solver.init(1 + n * m + 1);
    for (int i = 0 ; i < n ; i++) {
        for (int j = 0 ; j < m ; j++) {
            if ((i + j) % 2)
                solver.addEdge(0, 1 + (i * m + j), 1);
            else
                solver.addEdge(1 + (i * m + j), 1 + n * m, 1);
            for (int d = 0 ; d < 4 ; d++) {
                int nx = i + dx[d];
                int ny = j + dy[d];
                if (nx < 0 || nx >= n || ny < 0 || ny >= m)
                    continue;
                if (G[i][j] != '.' || G[nx][ny] != '.')
                    continue;
                if ((i + j) % 2)
                    solver.addEdge(1 + i * m + j, 1 + nx * m + ny, 1);
                else
                    solver.addEdge(1 + nx * m + ny, 1 + i * m + j, 1);
            }
        }
    }
    solver.run(0, 1 + n * m);
    cout << solver.flow << '\n';
    auto E = solver.E;
    for (int i = 0 ; i < E.size() ; i += 2) {
        if (E[i].u == 0 || E[i].v == 1 + n * m)
            continue;
        if (E[i].c)
            continue;
        int u = E[i].u - 1, v = E[i].v - 1;
        if (u > v) swap(u, v);
        pii x = {u / m, u % m};
        pii y = {v / m, v % m};
        if (x.F == y.F) {
            G[x.F][x.S] = '>';
            G[y.F][y.S] = '<';
        } else {
            G[x.F][x.S] = 'v';
            G[y.F][y.S] = '^';
        }
    }
    for (int i = 0 ; i < n ; i++) {
        for (int j = 0 ; j < m ; j++)
            cout << G[i][j];
        cout << '\n';
    }
}