#include <bits/stdc++.h>
using namespace std;
template<typename T>
struct MaxFlow{
  public:
    MaxFlow() : _n(0) {}
    MaxFlow(int n) : _n(n), g(n) {}//n頂点
    struct edge {
        int from, to;
        T cap, flow;
    };
    int add_edge(int from, int to, T cap) {
        int m = int(pos.size());
        pos.push_back(make_pair(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;
    }
    edge get_edge(int i) {
        //int m = int(pos.size());
        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, T new_cap, T 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;
    }
    T flow(int s, int t) {
        return flow(s, t, numeric_limits<T>::max());
    }
    T flow(int s, int t, T flow_limit) {
        vector<int> level(_n);
        vector<int> iter(_n);
        queue<int> que;
        auto bfs = [&]() {
            fill(level.begin(), level.end(), -1);
            level[s] = 0;
            queue<int> empty;
            swap(que, empty);
            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, T up) {
            if (v == s) {
                return up;
            }
            T 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;
                }
                T 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;
        };
        T flow = 0;
        while (flow < flow_limit) {
            bfs();
            if (level[t] == -1) break;
            fill(iter.begin(), iter.end(), 0);
            while (flow < flow_limit) {
                T f = dfs(dfs, t, flow_limit - flow);
                if (!f) break;
                flow += f;
            }
        }
        return flow;
    }
    vector<bool> min_cut(int s) {
        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;
        T cap;
    };
    vector<pair<int, int>> pos;
    vector<vector<_edge>> g;
};
int main(){
  #define int long long
  int N,M;
  cin>>N>>M;
  int count=N*M;
  vector<string> t(N);
  MaxFlow<int> rock(N*M+10);
  for(int i=0;i<N;i++){
    cin>>t.at(i);
    for(int j=0;j<M-1;j++){
      if(t.at(i).at(j)=='.' && t.at(i).at(j+1)=='.'){
        //cout<<i*M+j<<" "<<i*M+j+1<<endl;
        int check=0;
        if(i%2==0 && j%2==1){
          check++;
        }
        if(i%2==1 && j%2==0){
          check++;
        }
        if(check==0){
          rock.add_edge(i*M+j,i*M+j+1,1);
          //cout<<i*M+j<<" "<<i*M+j+1<<endl;
          //rock.add_edge(i*M+j+1,i*M+j,1);
          count++;
        }
      }
      if(t.at(i).at(j)=='.' && t.at(i).at(j+1)=='.'){
        //cout<<i*M+j<<" "<<i*M+j+1<<endl;
        //cout<<j*M+i<<" "<<(j+1)*M+i<<endl;
        int check=0;
        if(i%2==0 && (j+1)%2==1){
          check++;
        }
        if(i%2==1 && (j+1)%2==0){
          check++;
        }
        if(check==0){
          rock.add_edge(i*M+j+1,i*M+j,1);
          //cout<<i*M+j+1<<" "<<i*M+j<<endl;
          //rock.add_edge(i*M+j+1,i*M+j,1);
          count++;
        }
      }
    }
  }
  for(int i=0;i<M;i++){
    for(int j=0;j<N-1;j++){
      if(t.at(j).at(i)=='.' && t.at(j+1).at(i)=='.'){
        //cout<<j*M+i<<" "<<(j+1)*M+i<<endl;
        int check=0;
        if(j%2==0 && i%2==1){
          check++;
        }
        if(j%2==1 && i%2==0){
          check++;
        }
        if(check==0){
          rock.add_edge(j*M+i,(j+1)*M+i,1);
          //cout<<j*M+i<<" "<<(j+1)*M+i<<endl;
          //rock.add_edge((j+1)*M+i,j*M+i,1);
          count++;
        }
      }
      if(t.at(j).at(i)=='.' && t.at(j+1).at(i)=='.'){
        //cout<<j*M+i<<" "<<(j+1)*M+i<<endl;
        int check=0;
        if((j+1)%2==0 && i%2==1){
          check++;
        }
        if((j+1)%2==1 && i%2==0){
          check++;
        }
        if(check==0){
          rock.add_edge((j+1)*M+i,j*M+i,1);
          //cout<<(j+1)*M+i<<" "<<j*M+i<<endl;
          //rock.add_edge((j+1)*M+i,j*M+i,1);
          count++;
        }
      }
    }
  }
  int start=N*M+1;
  int goal=N*M+2;
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      if(i%2==0){
        if(j%2==0){
          rock.add_edge(start,i*M+j,1);
        }
        else{
          rock.add_edge(i*M+j,goal,1);
        }
      }
      if(i%2==1){
        if(j%2==1){
          rock.add_edge(start,i*M+j,1);
        }
        else{
          rock.add_edge(i*M+j,goal,1);
        }
      }
    }
  }
  int a=rock.flow(start,goal);
  cout<<a<<endl;
  for(int i=0;i<count;i++){
    //cout<<rock.get_edge(i).from<<" "<<rock.get_edge(i).to<<" "<<rock.get_edge(i).cap<<" "<<rock.get_edge(i).flow<<endl;
    if(rock.get_edge(i).flow==1){
      int v=rock.get_edge(i).from;
      int nv=rock.get_edge(i).to;
      if(v>N*M || nv>N*M){
        continue;
      }
      if(max(nv-v,v-nv)==1 && M!=1){
        if(v<nv){
          t.at(v/M).at(v%M)='>';
          t.at(nv/M).at(nv%M)='<';
        }
        else{
          t.at(v/M).at(v%M)='<';
          t.at(nv/M).at(nv%M)='>';
        }
      }
      else{
        if(v<nv){
          t.at(v/M).at(v%M)='v';
          t.at(nv/M).at(nv%M)='^';
        }
        else{
          t.at(v/M).at(v%M)='^';
          t.at(nv/M).at(nv%M)='v';
        }
      }
    }
  }
  for(int i=0;i<N;i++){
    cout<<t.at(i)<<endl;
  }
}

Measured memory_bytes: 5432