We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 611cd91 commit ed139c7Copy full SHA for ed139c7
jaykxo/week02/10798_세로읽기.py
@@ -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