#include <bits/stdc++.h>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL,LL> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<char> VC;
typedef vector<VC> VVC;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQGI; //大きい順
typedef priority_queue<int, VI, greater<int>> PQLI;
typedef priority_queue<PII> PQGP;
typedef priority_queue<PII, VPII, greater<PII>> PQLP;
//priority_queue<T,vector<T>,decltype(f)> pq{f};

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EB emplace_back
#define EF emplace_front
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).rbegin(), (c).rend())
#define LB lower_bound
#define UB upper_bound
#define NEXP next_permutation
#define FI first
#define SE second
#define Vmin(a) *min_element((a).begin(),(a).end())
#define Vmax(a) *max_element((a).begin(),(a).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FORR(i,a,b) for(int i = (b-1);i>=(a);i--)
#define REPR(i,n) FORR(i,0,n)
#define CFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define CREP(i,n)  CFOR(i,0,n)
#define CFORR(i,a,b) for(int i = (b);i>=(a);i--)
#define CREPR(i,n) CFORR(i,0,n)
#define BFOR(bit,a,b) for(int bit = (a); bit < (1<<(b)); ++bit)
#define BREP(bit,n) BFOR(bit,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INF = INT_MAX/2;
const LL LINF = LLONG_MAX/3;
const int RINF = INT_MIN/2;
const LL RLINF = LLONG_MIN/3;
const LL MOD = 1e9+7;
const LL MODD = 998244353;
const int MAX = 510000;

inline bool Eq(double a, double b) { return fabs(b - a) < EPS; }

//other
//-------------------------------------------
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define COUT(x) cout << (x) << endl
#define COUT2(x,y) cout << (x) << " " << (y) << endl
#define COUT3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define PR(x) cout << (x)
#define ENDL cout << endl
#define SPACE cout << " "
#define BC(x) __builtin_popcountll(x)

VI dx = {1,0,-1,0,1,1,-1,-1};
VI dy = {0,1,0,-1,1,-1,1,-1};

LL Gcd(LL a, LL b) {return __gcd(a,b);}
LL Lcm(LL a, LL b) {return a/Gcd(a,b)*b;}

LL ModPow(LL A, LL N, LL M=MOD){
  LL res = 1;
  while(N>0){
    if(N&1) res = res * A % M;
    A = A * A % M;
    N >>= 1;
  }
  return res;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

template <class Cap>
struct Dinic{
  int n;
  const Cap LIM;
  struct edge{
    int to, rev;
    Cap cap;
    edge(int to, int rev, Cap cap) : to(to), rev(rev), cap(cap) {}
  };
  VPII pos;
  vector<vector<edge>> graph;
  
  Dinic(): n(0), LIM(numeric_limits<Cap>::max()) {}
  Dinic(int n): n(n), LIM(numeric_limits<Cap>::max()), graph(n) {}

  int add_edge(int from, int to, Cap cap){
    int res = SZ(pos);
    pos.EB(from, SZ(graph.at(from)));
    graph.at(from).EB(to, SZ(graph.at(to)), cap);
    graph.at(to).EB(from, SZ(graph.at(from))-1, 0);
    return res;
  }

  void change_edge(int i, Cap new_cap, Cap new_flow){
    auto& e = graph.at(pos.at(i).FI).at(pos.at(i).SE);
    auto& re = graph.at(e.to).at(e.rev);
    e.cap = new_cap - new_flow;
    re.cap = new_flow;
  }

  Cap flow(int s, int t){
    return flow(s, t, LIM);
  }
  Cap flow(int s, int t, Cap flow_limit){
    VI level(n), iter(n);

    auto bfs = [&](){
      fill(ALL(level), -1);
      level.at(s) = 0;
      queue<int> que;
      que.push(s);
      while(!que.empty() && level.at(t)==-1){
        int v = que.front(); que.pop();
        for(auto e : graph.at(v)){
          if(e.cap==0 || level.at(e.to)>=0) continue;
          level.at(e.to) = level.at(v)+1;
          que.push(e.to);
        }
      }
    };
    auto dfs = [&](auto self, const int v, Cap up){
      if(v == s) return up;
      Cap res = 0;
      int lv = level.at(v);
      FOR(i, iter.at(v), SZ(graph.at(v))){
        edge &e = graph.at(v).at(i);
        if(lv<=level.at(e.to) || graph.at(e.to).at(e.rev).cap==0) continue;
        Cap d = self(
          self, e.to, min(up-res, graph.at(e.to).at(e.rev).cap)
          );
        if(d <= 0) continue;
        graph.at(v).at(i).cap += d;
        graph.at(e.to).at(e.rev).cap -= d;
        res += d;
        if(res == up) break;
      }
      return res;
    };

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

  VB min_cut(int s){
    VB visited(n,false);
    queue<int> que;
    que.push(s);
    while(!que.empty()){
      int p = que.front(); que.pop();
      visited.at(p) = true;
      for(auto e : graph.at(p)){
        if(e.cap && !visited.at(e.to)){
          visited.at(e.to) = true;
          que.push(e.to);
        }
      }
    }
    return visited;
  }

  struct egdeinfo{
    int from, to;
    Cap cap, flow;
    egdeinfo(int from, int to, Cap cap, Cap flow):from(from), to(to), cap(cap), flow(flow) {}
  };
  egdeinfo get_edge(int i){
    auto [x,y] = pos.at(i);
    auto e = graph.at(x).at(y);
    auto re = graph.at(e.to).at(e.rev);
    return egdeinfo(x, e.to, e.cap+re.cap, re.cap);
  }
  vector<egdeinfo> edges(){
    vector<egdeinfo> res;
    int m = SZ(pos);
    REP(i,m) res.EB(get_edge(i));
    return res;
  }
};

int main() {

  // cin.tie(0);
  // ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int N, M;
  cin >> N >> M;

  VS S(N);
  cin >> S;

  Dinic<int> g(N*M+2);

  int s = N*M, t = N*M+1;

  REP(i,N)REP(j,M){
    if(S.at(i).at(j) == '#')continue;
    int v = i*M + j;
    if((i+j)%2 == 0){
      g.add_edge(s, v, 1);

      REP(k,4){
        int x = i+dx.at(k), y = j+dy.at(k);
        if(x<0||N<=x||y<0||M<=y) continue;
        if(S.at(x).at(y) == '#')continue;
        int u = x*M + y;
        g.add_edge(v, u, 1);
      }
    }else{
      g.add_edge(v, t, 1);
    }
  }

  COUT(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) {
      S.at(i1).at(j1) = 'v';
      S.at(i0).at(j0) = '^';
    } else if (j0 == j1 + 1) {
      S.at(i1).at(j1) = '>';
      S.at(i0).at(j0) = '<';
    } else if (i0 == i1 - 1) {
      S.at(i0).at(j0) = 'v';
      S.at(i1).at(j1) = '^';
    } else {
      S.at(i0).at(j0) = '>';
      S.at(i1).at(j1) = '<';
    }
  }

  REP(i,N) COUT(S.at(i));

  return 0;
}

Measured memory_bytes: 5712