QA & Engineering Blog

A Blog about Quality · Automation · Engineering

🏠 홈으로

1234. [S/W 문제해결 기본] 10일차 - 비밀번호

업데이트 시간 : 2023-02-13 08:16:53 +0000

[D3] [S/W 문제해결 기본] 10일차 - 비밀번호 - 1234

문제 링크

성능 요약

메모리: 42,180 KB, 시간: 96 ms, 코드길이: 358 Bytes

출처: SW Expert Academy, https://swexpertacademy.com/main/code/problem/problemList.do

💡 Solutions

📄 [S/W 문제해결 기본] 10일차 - 비밀번호.py

for j in range(1,11):
    n, word = input().split()


    stack=[]
    for i in range(int(n)): #1238099084
        if len(stack) ==0:
            stack.append(word[i])
        else:
            top=stack[-1]
            if top==word[i]:
                stack.pop()
            else:
                stack.append(word[i])

    print(f'#{j} {"".join(stack)}')