์‹ค๋ฒ„1 : ๊ทธ๋ฆฌ๋”” ๋ฌธ์ œ์ด๋‹ค.

ํ’€์ด

์ฒ˜์Œ์— ๋ถ€๋ฅดํŠธ ํฌ์Šค๋กœ ์ ‘๊ทผํ–ˆ๋‹ค๊ฐ€, ์‹œ๊ฐ„์ดˆ๊ณผ๊ฐ€ ๋‚ฌ๋‹ค. ๊ทธ๋ž˜์„œ ๊ทธ๋ฆฌ๋””๋กœ ๋ฐฉํ–ฅ์„ ์ „ํ–ฅํ–ˆ๋‹ค. >๊ฐ€ ๋‚˜์™”์„ ๋•Œ, ๊ฐ€์žฅ ํฐ ์ˆซ์ž๋ฅผ ์„ค์ •ํ•ด๋‘๊ณ , ์ดํ•˜ ๋ถ€ํ„ฐ ์ˆœ์„œ๋Œ€๋กœ ์ด์ˆซ์ž๋ฅผ ์ฑ„์šฐ๋Š” ๊ฒƒ์œผ๋กœ ํ•ด๋‹น ์กฐ๊ฑด์„ ๋งŒ์กฑ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‹ค.

Code

import sys
from itertools import permutations
 
input = sys.stdin.readline
 
n = int(input())
operator_list = input().split()
ans = ""
count = 0
top = 9
for operator in operator_list:
    if operator == ">":
        for i in range(top - count, top + 1):
            ans += str(i)
        top = top - count - 1
        count = 0
    else:
        count += 1
for i in range(top - count, top + 1):
    ans += str(i)
top = top - count - 1
count = 0
print(ans)
 
ans = ""
count = 0
top = 0
for operator in operator_list:
    if operator == "<":
        for i in range(top + count, top - 1, -1):
            ans += str(i)
        top = top + count + 1
        count = 0
    else:
        count += 1
for i in range(top + count, top - 1, -1):
    ans += str(i)
top = top + count + 1
count = 0
print(ans)

Reference