Skip to content

Commit ed139c7

Browse files
committed
Solved: 10798 세로읽기
1 parent 611cd91 commit ed139c7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import sys
2+
input = sys.stdin.readline
3+
4+
# 1) 5줄 입력받아 리스트에 저장
5+
lines = []
6+
for _ in range(5):
7+
line = input().strip() # 한 줄 입력받고 개행 제거
8+
lines.append(line)
9+
10+
# 2) 가장 긴 문자열의 길이 구하기
11+
max_len = max(len(line) for line in lines)
12+
13+
# 3) 세로로 읽기: 열을 기준으로 각 줄을 돌며 문자 추가
14+
result = ""
15+
for c in range(max_len): # 열(column) 기준
16+
for r in range(len(lines)): # 행(row) 기준
17+
if c < len(lines[r]): # 해당 줄에 문자가 존재하면
18+
result += lines[r][c]
19+
20+
# 4) 결과 문자열 출력
21+
print(result)

0 commit comments

Comments
 (0)