Skip to content

Commit c68ae4b

Browse files
Create S2.py
1 parent 981105a commit c68ae4b

File tree

1 file changed

+13
-0
lines changed
  • 2010/Senior Problems

1 file changed

+13
-0
lines changed

2010/Senior Problems/S2.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
dict1 = {}
2+
for t in range(int(input(''))):
3+
encoded_value = input().split(' ')
4+
dict1[encoded_value[0]] = encoded_value[1]
5+
encoded_string = input('')
6+
decoded_string = ''
7+
index = 0
8+
for a in range(len(encoded_string)):
9+
for k,v in dict1.items():
10+
if encoded_string[index:index+len(v)]==v:
11+
index=index+len(v)
12+
decoded_string+=k
13+
print(decoded_string)

0 commit comments

Comments
 (0)