practivceAlgorithm/swexpertacademy

[SWEA][Python] 5536 의석이의 세로로 말해요

findTheValue 2021. 8. 15. 18:58

문자열이 다 빌때까지 제거하며 더해줬다.

 

def read_vertical(s):
    answer = ''
    cnt = 0
    while cnt <= 15:
        for string in s:
            if string:
                answer += string.pop(0)
        cnt+=1
    return answer


for test in range(1, int(input())+1):
    strings = list(list(input()) for _ in range(5))
    print(f'#{test} {read_vertical(strings)}')