Skip to content

Commit 052faa4

Browse files
author
shiv
committed
added total decodings code
1 parent b0e20a3 commit 052faa4

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

.sum_pairs.py.swp

-12 KB
Binary file not shown.

ip.txt

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
2
2-
5 5 9
3-
1 2 4 5 7
4-
5 6 3 4 8
5-
2 2 3
6-
0 2
7-
1 3
2+
3
3+
123
4+
4
5+
2563

total_decodings.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#SHIV's code for total decodings
2+
3+
'''
4+
sample input:
5+
6+
2
7+
3
8+
123
9+
4
10+
2563
11+
'''
12+
13+
tn = int(input())
14+
15+
def process(num):
16+
count = 1
17+
for ind, c in enumerate(num[:-1]):
18+
if int(c+num[i+1]) <= 26:
19+
count+=1
20+
print(count)
21+
22+
for i in range(tn):
23+
ndig = int(input())
24+
num = input()
25+
process(num)

0 commit comments

Comments
 (0)