ALC001 al coding club contest

can somebody just give me the approach how to solve it?

I’m using 1-based indexing.
S = input string
L = length of S
N = L + 1
A = [1, 2, 3, ..., N]

Here’s a rough algorithm:

i \leftarrow 2; i \leq N; i \leftarrow i + 1:

  • if S[i - 1] = "-" then:
    j \leftarrow i; j > 1 and S[j - 1] = "-":
    swap(A[j] and A[j - 1])

A contains the answer.

1 Like

:smile:

@raisinten @somak_17 thanks for the help bro:smile:

2 Likes