//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, a, n) for(ll i = a; i < (ll)(n); ++i)
#define repr(i, a, n) for(ll i = n - 1; (ll)a <= i; --i)
#define ENDL '\n'
typedef pair<int, int> Pi;
typedef pair<ll, ll> PL;
constexpr ll mod = 1000000007;  // 998244353;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 + 99);
const ld PI = acos((ld)-1);
const vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
template <typename T, typename U> inline bool chmin(T& t, const U& u) {
  if(t > u) {
    t = u;
    return 1;
  }
  return 0;
}
template <typename T, typename U> inline bool chmax(T& t, const U& u) {
  if(t < u) {
    t = u;
    return 1;
  }
  return 0;
}
template <typename T> inline T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

template <typename T, typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(; n; n >>= 1) {
    if(n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template <typename T> V<T> prefix_sum(const V<T>& v) {
  int n = v.size();
  V<T> ret(n + 1);
  rep(i, 0, n) ret[i + 1] = ret[i] + v[i];
  return ret;
}

template <typename T> istream& operator>>(istream& is, vector<T>& vec) {
  for(auto&& x : vec) is >> x;
  return is;
}

template <typename T, typename Y>
ostream& operator<<(ostream& os, const pair<T, Y>& p) {
  return os << "{" << p.fs << "," << p.sc << "}";
}

template <typename T> ostream& operator<<(ostream& os, const V<T>& v) {
  os << "{";
  for(auto e : v) os << e << ",";
  return os << "}";
}

template <typename... Args> void debug(Args&... args) {
  for(auto const& x : {args...}) { cerr << x << ' '; }
  cerr << ENDL;
}

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())});
    g[from].push_back(_edge{to, int(g[to].size()), cap});
    g[to].push_back(_edge{from, int(g[from].size()) - 1, 0});
    return m;
  }

  struct edge {
    int from, to;
    Cap cap, flow;
  };

  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};
  }
  std::vector<edge> edges() {
    int m = int(pos.size());
    std::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, std::numeric_limits<Cap>::max()); }
  Cap flow(int s, int t, Cap flow_limit) {
    assert(0 <= s && s < _n);
    assert(0 <= t && t < _n);

    std::vector<int> level(_n), iter(_n);
    queue<int> que;

    auto bfs = [&]() {
      std::fill(level.begin(), level.end(), -1);
      level[s] = 0;
      queue<int>().swap(que);
      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, std::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;
      std::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;
  }

  std::vector<bool> min_cut(int s) {
    std::vector<bool> visited(_n);
    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;
  };
  std::vector<std::pair<int, int>> pos;
  std::vector<std::vector<_edge>> g;
};

V<string> v;

void solve() {
  ll n, m;
  cin >> n >> m;
  v.resize(n);
  cin >> v;

  mf_graph<ll> mf(n * m + 2);

  rep(i, 0, n) {
    rep(j, 0, m) {
      if(v[i][j] == '#') continue;

      if((i + j) % 2 == 0)
        mf.add_edge(n*m,i * m + j, 1);
      else
        mf.add_edge(i * m + j, n * m + 1, 1);
    }
  }

  rep(i, 0, n) {
    rep(j, 0, m) {
      if(v[i][j] == '#') continue;
      if((i + j) % 2) continue;

      int ng, nr;
      rep(k, 0, 4) {
        ng = i + dx[k];
        nr = j + dy[k];

        if(ng < 0 || ng >= n || nr < 0 || nr >= m) continue;
        if(v[ng][nr] == '#') continue;

        mf.add_edge(i * m + j, ng * m + nr, 1);
      }
    }
  }

  cout << mf.flow(n * m, n * m + 1) << ENDL;

  auto es = mf.edges();
  rep(i, 0, siz(es)) {
    if(es[i].flow == 0) continue;

    int fr = es[i].from, to = es[i].to;
    if(fr == n * m || to == n * m + 1) continue;

    int i0 = fr / m, j0 = fr % m, i1 = to / m, j1 = to % m;

    if(i0 + 1 == i1) {
      v[fr / m][fr % m] = 'v';
      v[to / m][to % m] = '^';
    } else if(i1 + 1 == i0) {
      v[fr / m][fr % m] = '^';
      v[to / m][to % m] = 'v';
    } else if(j0 + 1 == j1) {
      v[fr / m][fr % m] = '>';
      v[to / m][to % m] = '<';
    } else if(j1 + 1 == j0) {
      v[fr / m][fr % m] = '<';
      v[to / m][to % m] = '>';
    }
  }

  rep(i, 0, n) { cout << v[i] << ENDL; }
}

signed main() {
  cin.tie(0);
  cerr.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  solve();
}
//! ( . _ . ) !
// CHECK overflow,vector_size,what to output?

Measured memory_bytes: 6292