본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 4592번 중복을 없애자

by 현장 2022. 6. 6.

-Code

while 1:
    manggo = list(map(int, input().split()))

    if manggo[0] == 0:
        break
    result = []
    for i in manggo[1:]:
        if len(result) != 0 and result[-1] == i:
            continue
        result.append(i)
    result.append('$')
    print(*result)