#include #define REP(i, n) for(int i = 0; i< n; i++) #define SIZE 123 using namespace std; int N, n; char table[SIZE][SIZE], _table[SIZE][SIZE]; int op(int x, char c){ switch(c){ case '|': return (15-x)%8; case '-': return (11-x)%8; case '/': return (9-x)%8; case '\\': return (13-x)%8; case '>': return (2+x)%8; case '<': return (6+x)%8; } return -1000000; } char rotc(char c){ switch(c){ /* case '<': return '^'; case '>': return 'v'; case '^': return '>'; case 'v': return '<'; */ case '<': return 'v'; case '>': return '^'; case '^': return '<'; case 'v': return '>'; case '|': return '-'; case '-': return '|'; case '/': return '\\'; case '\\': return '/'; default: return c; } } char klopc(char c){ switch(c){ case '<': return '>'; case '>': return '<'; case '/': return '\\'; case '\\': return '/'; default: return c; } } void rot(){ REP(i, n)REP(j, n){ _table[j][n-1-i] = rotc(table[i][j]); } REP(i, n)REP(j, n)table[i][j] = _table[i][j]; } void klop(){ REP(i, n)REP(j, n){ _table[n-1-i][j] = klopc(table[i][j]); } REP(i, n)REP(j, n)table[i][j] = _table[i][j]; } void solve(int im){ if((im%2) == 0){ REP(i, im/2)rot(); return; } REP(i, (im+1)/2)rot(); klop(); } bool testcase(){ cin >> N; n=N; if(cin.fail())return false; string s; REP(i, N){ cin >> s; REP(j, N)table[i][j] = s[j]; } int x = 0; cin.get(); char c; while((c = cin.get()) != '\n' && !cin.fail()){ if(c == ' ')continue; // cerr << c << endl; x = op(x, c); } solve(x); REP(i, n){ REP(j, n)cout<