백준 5357번: Dedupe #Python

ColorlessDia·2025년 4월 27일

algorithm/baekjoon

목록 보기
525/807
import sys

input = sys.stdin.readline

T = int(input())

for _ in range(T):
    line = input().rstrip()

    temp = line[0]

    for char in line[1:]:
        
        if temp[-1] == char:
            continue
        
        temp += char

    print(temp)

0개의 댓글