#include <bits/stdc++.h>
#define INF 2000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

//=============max_flow============================
template <class T> struct simple_queue {
    vector<T> payload;
    int pos = 0;
    void reserve(int n) { payload.reserve(n); }
    int size() const { return int(payload.size()) - pos; }
    bool empty() const { return pos == int(payload.size()); }
    void push(const T& t) { payload.push_back(t); }
    T& front() { return payload[pos]; }
    void clear() {
        payload.clear();
        pos = 0;
    }
    void pop() { pos++; }
};
struct edge {
  int from, to;
  ll cap, flow;
};
template <class Cap> struct mf_graph {
  public:
    mf_graph() : _n(0) {}
    mf_graph(int n) : _n(n), g(n) {}

    int add_edge(int from, int to, Cap cap) {
        assert(0 <= from && from < _n);
        assert(0 <= to && to < _n);
        assert(0 <= cap);
        int m = int(pos.size());
        pos.push_back({from, int(g[from].size())});
        int from_id = int(g[from].size());
        int to_id = int(g[to].size());
        if (from == to) to_id++;
        g[from].push_back(_edge{to, to_id, cap});
        g[to].push_back(_edge{from, from_id, 0});
        return m;
    }

    edge get_edge(int i) {
        int m = int(pos.size());
        assert(0 <= i && i < m);
        auto _e = g[pos[i].first][pos[i].second];
        auto _re = g[_e.to][_e.rev];
        return edge{pos[i].first, _e.to, _e.cap + _re.cap, _re.cap};
    }
    vector<edge> edges() {
        int m = int(pos.size());
        vector<edge> result;
        for (int i = 0; i < m; i++) {
            result.push_back(get_edge(i));
        }
        return result;
    }
    void change_edge(int i, Cap new_cap, Cap new_flow) {
        int m = int(pos.size());
        assert(0 <= i && i < m);
        assert(0 <= new_flow && new_flow <= new_cap);
        auto& _e = g[pos[i].first][pos[i].second];
        auto& _re = g[_e.to][_e.rev];
        _e.cap = new_cap - new_flow;
        _re.cap = new_flow;
    }

    Cap flow(int s, int t) {
        return flow(s, t, numeric_limits<Cap>::max());
    }
    Cap flow(int s, int t, Cap flow_limit) {
        assert(0 <= s && s < _n);
        assert(0 <= t && t < _n);
        assert(s != t);

        vector<int> level(_n), iter(_n);
        simple_queue<int> que;

        auto bfs = [&]() {
            fill(level.begin(), level.end(), -1);
            level[s] = 0;
            que.clear();
            que.push(s);
            while (!que.empty()) {
                int v = que.front();
                que.pop();
                for (auto e : g[v]) {
                    if (e.cap == 0 || level[e.to] >= 0) continue;
                    level[e.to] = level[v] + 1;
                    if (e.to == t) return;
                    que.push(e.to);
                }
            }
        };
        auto dfs = [&](auto self, int v, Cap up) {
            if (v == s) return up;
            Cap res = 0;
            int level_v = level[v];
            for (int& i = iter[v]; i < int(g[v].size()); i++) {
                _edge& e = g[v][i];
                if (level_v <= level[e.to] || g[e.to][e.rev].cap == 0) continue;
                Cap d =
                    self(self, e.to, min(up - res, g[e.to][e.rev].cap));
                if (d <= 0) continue;
                g[v][i].cap += d;
                g[e.to][e.rev].cap -= d;
                res += d;
                if (res == up) break;
            }
            return res;
        };

        Cap flow = 0;
        while (flow < flow_limit) {
            bfs();
            if (level[t] == -1) break;
            fill(iter.begin(), iter.end(), 0);
            while (flow < flow_limit) {
                Cap f = dfs(dfs, t, flow_limit - flow);
                if (!f) break;
                flow += f;
            }
        }
        return flow;
    }

    vector<bool> min_cut(int s) {
        vector<bool> visited(_n);
        simple_queue<int> que;
        que.push(s);
        while (!que.empty()) {
            int p = que.front();
            que.pop();
            visited[p] = true;
            for (auto e : g[p]) {
                if (e.cap && !visited[e.to]) {
                    visited[e.to] = true;
                    que.push(e.to);
                }
            }
        }
        return visited;
    }

  private:
    int _n;
    struct _edge {
        int to, rev;
        Cap cap;
    };
    vector<pair<int, int>> pos;
    vector<vector<_edge>> g;
};
//=========================================

ll N, M;
ll row = 101;
void update(ll f, ll s, vector<vector<char>>& maze) {
  if (f > s) {
    swap(f, s);
  }
  // if (maze.at(f / M + 1).at(f % M + 1) != '.' || maze.at(s / M + 1).at(s % M + 1) != '.') {
  //   return;
  // }
  if (f + 1 == s) {
    maze.at(f / row + 1).at(f % row + 1) = '>';
    maze.at(s / row + 1).at(s % row + 1) = '<';
  }
  else {
    maze.at(f / row + 1).at(f % row + 1) = 'v';
    maze.at(s / row + 1).at(s % row + 1) = '^';
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> M;
  mf_graph<ll> graph(N * row + 2);
  vector<vector<char>> maze(N + 2, vector<char>(M + 2, '#'));
  vector<pll> move = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
  for (ll i = 1; i <= N; ++i) {
    string S;
    cin >> S;
    for (ll j = 0; j < M; ++j) {
      maze.at(i).at(j + 1) = S.at(j);
    }
  }
  for (ll i = 0; i < N; ++i) {
    for (ll j = 0; j < M; ++j) {
      if (maze.at(i + 1).at(j + 1) == '#') {
        continue;
      }
      if ((i + j) % 2 == 0) {
        graph.add_edge(N *  row, i * row + j, 1);
        for (ll k = 0; k < 4; ++k) {
          if (maze.at(i + 1 + move.at(k).first).at(j + 1 + move.at(k).second) == '#') {
            continue;
          }
          graph.add_edge(i * row + j, (i + move.at(k).first) * row + j + move.at(k).second, 1);
        }
      }
      else {
        graph.add_edge(i * row + j, N * row + 1, 1);
        // for (ll k = 0; k < 4; ++k) {
        //   if (maze.at(i + 1 + move.at(k).first).at(j + 1 + move.at(k).second) == '#') {
        //     continue;
        //   }
        //   graph.add_edge((i + move.at(k).first) * M + j + move.at(k).second, i * M + j, 1);
        // }
      }
    }
  }
  cout << graph.flow(N * row, N * row + 1) << "\n";
  vector<edge> es = graph.edges();
  for (ll i = 0; i < es.size(); ++i) {
    edge e = es.at(i);
    if (e.from == N * row || e.to == N * row + 1) {
      continue;
    }
    if (e.flow == 1) {
      update(e.from, e.to, maze);
    }
  }
  for (ll i = 1; i <= N; ++i) {
    for (ll j = 1; j <= M; ++j) {
      cout << maze.at(i).at(j);
    }
    cout << "\n";
  }
}


Measured memory_bytes: 6324