์ค๋ฒ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)