https://www.acmicpc.net/problem/10798
10798번: 세로읽기
총 다섯줄의 입력이 주어진다. 각 줄에는 최소 1개, 최대 15개의 글자들이 빈칸 없이 연속으로 주어진다. 주어지는 글자는 영어 대문자 ‘A’부터 ‘Z’, 영어 소문자 ‘a’부터 ‘z’, 숫자 ‘0’
www.acmicpc.net
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
def sol(strings):
answer = ''
for i in range(15):
for s in strings:
if s:
answer += s[0]
s.pop(0)
else:
continue
return answer
if __name__ == '__main__':
strings = [list(input()) for i in range(5)]
print(sol(strings))
|
cs |
한 줄당 최대 15글자 이니까
15번 돌면서 pop사용하면서 반복함
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 3038. Maximum Number of Operations With the Same Score I (0) | 2024.02.18 |
---|---|
leetcode 1941. Check if All Characters Have Equal Number of Occurrences (0) | 2024.02.17 |
leetcode 1732. Find the Highest Altitude (1) | 2024.02.15 |
leetcode 2784. Check if Array is Good (0) | 2024.02.14 |
leetcode 3024. Type of Triangle (0) | 2024.02.13 |
댓글