#AGC053A. [AGC053A] >< again

[AGC053A] >< again

Score : 400400 points

Problem Statement

We have a string SS of length NN, where each character is < or >.

A non-negative integer sequence of N+1N+1 elements, X0,X1,,XNX_0,X_1,\ldots,X_N, is said to be good when it satisfies the following for every 1iN1 \leq i \leq N:

  • Xi1,ifX_{i-1}, if S_i$ is <;
  • Xi1>XiX_{i-1}>X_i, if SiS_i is >.

Given a good non-negative integer sequence AA, divide it into as many good non-negative integer sequences as possible. That is, find a positive integer kk and kk good non-negative integer sequences B1,B2,,BkB_1,B_2,\ldots, B_k satisfying the following with the maximum possible value of kk:

  • For every 0iN0 \leq i \leq N, the sum of the ii-th elements of B1,,BkB_1,\ldots,B_k equals AiA_i.

Constraints

  • 1N1001 \leq N \leq 100
  • 0Ai1040 \leq A_i \leq 10^4
  • SS is a string of length NN consisting of < and >.
  • AA is a good non-negative integer sequence. Particularly, AA has N+1N+1 elements.

Input

Input is given from Standard Input in the following format:

NN

SS

A0A_0 A1A_1 \cdots ANA_N

Output

Print your answer to Standard Output in the following format:

kk

B1,0B_{1,0} B1,1B_{1,1} \cdots B1,NB_{1,N}

::

Bk,0B_{k,0} Bk,1B_{k,1} \cdots Bk,NB_{k,N}

Here, Bi,jB_{i,j} denotes the value of the jj-th element of the good non-negative integer sequence BiB_i.

3
<><
3 8 6 10
2
1 5 4 7
2 3 2 3