Skip to content

Commit b4a3147

Browse files
authored
Add files via upload
0 parents  commit b4a3147

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

tb1_pemrograman_lanjut.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
'''
2+
Nama: Naufal Rahfi Anugerah
3+
NIM: 41822010038
4+
'''
5+
6+
import re
7+
8+
first_input = input().rstrip().split()
9+
n = int(first_input[0])
10+
m = int(first_input[1])
11+
12+
matrix = []
13+
for _ in range(n):
14+
matrix_items = input()
15+
matrix.append(matrix_items)
16+
17+
decode_msg = ""
18+
for i in range(m):
19+
for j in range(n):
20+
try:
21+
decode_msg += matrix[j][i]
22+
except IndexError:
23+
pass
24+
25+
pattern = r'(?<=[\w])[^\w]+(?=[\w])'
26+
match_msg = re.findall(pattern, decode_msg)
27+
28+
for x in match_msg:
29+
decode_msg = decode_msg.replace(x, ' ', 1)
30+
print(decode_msg)

text.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
7 3
2+
Tsi
3+
h%x
4+
i #
5+
sM
6+
$a
7+
#t%
8+
ir!

0 commit comments

Comments
 (0)