2025 S2 - Cryptogram Cracking Club
Normalsimple math
1 Solution Available
Solution 1
PYTHON1# By Daniel Zhang, Pinetree Secondary
2
3
4s = input().strip()
5c = int(input())
6blocks = []
7i = 0
8n = len(s)
9
10while i < n:
11 letter = s[i]
12 i += 1
13 j = i
14 while j < n and s[j].isdigit():
15 j += 1
16 blocks.append((letter, int(s[i:j])))
17 i = j
18
19total = 0
20for _, count in blocks:
21 total += count
22
23c %= total
24for letter, count in blocks:
25 if c < count:
26 print(letter)
27 break
28 c -= count
Test Cases
Select a test case to view input and output