#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
#define rreps(i, n) for(int i=((int)(n)); i>0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pl(s) cout << (s) << "\n";
#define pls(...) {bool space = false; for(auto i : __VA_ARGS__) (cout << (space?" ":"") << i), space = true; cout << "\n";}
#define plexit(s) {cout << (s) << "\n"; exit(0);}
#define yes(s) cout << ((s)?"Yes":"No") << "\n";
#ifdef __LOCAL
#include <dump.hpp>
#define dump(...) DUMPOUT << "  " << string(#__VA_ARGS__) << ": " << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl << "    ", dump_func(__VA_ARGS__)
#else
#define dump(...)
#endif
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct IOInit { IOInit() { cin.tie(nullptr); ios::sync_with_stdio(false); dump("READY"); /*cout << unitbuf;*/} } IO_INIT;
using ll = long long; using ull = unsigned long long; using ld = long double;
template<typename T = int> using V = vector<T>; template<typename T = int> using P = pair<T, T>;
using Vi = V<int>; using Vl = V<ll>; using Vd = V<ld>; using VVi = V<Vi>; using VVl = V<Vl>; using Pi = P<int>; using Pl = P<ll>; using Pd = P<ld>;
constexpr ll MOD = 1000000007; constexpr int INF = (1 << 30) - 1; constexpr ll INFL = 1LL << 60; constexpr ld EPS = 1e-12; constexpr ld PI = 3.141592653589793238462643383279;

signed main(void) {
  int n, m; cin >> n >> m;
  V<string> grid(n);
  rep(i,n) cin >> grid[i];

  mf_graph<int> g(n * m + 2);
  int s = n * m, t = n * m + 1;
  rep(i,n){
    rep(j,m) {
      if (grid[i][j] == '#') continue;
      int v = i * m + j;
      if ((i + j) % 2 == 0) {
        g.add_edge(s, v, 1);
      } else {
        g.add_edge(v, t, 1);
      }
    }
  }

  int di, dj;
  rep(i,n){
    rep(j,m) {
      if ((i+j)%2 || grid[i][j] == '#') continue;
      int v0 = i * m + j;
      di = i - 1; dj = j;
      if ( i && grid[di][dj] == '.') { int v1 = di * m + dj; g.add_edge(v0, v1, 1); }
      di = i    ; dj = j - 1;
      if ( j && grid[di][dj] == '.') { int v1 = di * m + dj; g.add_edge(v0, v1, 1); }
      di = i + 1; dj = j;
      if (di < n && grid[di][dj] == '.') { int v1 = di * m + dj; g.add_edge(v0, v1, 1); }
      di = i    ; dj = j + 1;
      if (dj < m && grid[di][dj] == '.') { int v1 = di * m + dj; g.add_edge(v0, v1, 1); }
    }
  }

  pl(g.flow(s, t));

  auto edges = g.edges();
  for (auto e: edges) {
    if (e.from == s || e.to == t || e.flow == 0) continue;
    int i0 = e.from / m, j0 = e.from % m;
    int i1 = e.to / m, j1 = e.to % m;

    if (i0 == i1 + 1) {
      grid[i1][j1] = 'v';
      grid[i0][j0] = '^';
    } else if (j0 == j1 + 1) {
      grid[i1][j1] = '>'; grid[i0][j0] = '<';
    } else if (i0 == i1 - 1) {
      grid[i0][j0] = 'v';
      grid[i1][j1] = '^';
    } else {
      grid[i0][j0] = '>'; grid[i1][j1] = '<';
    }
  }

  rep(i,n) pl(grid[i])
  return 0;
}


Measured memory_bytes: 5632