Marks :10
: 4 | : 0
Given a string $$$S$$$ containing only digits, find the number of ways to decode it as per the rules explained below.
To decode an encoded message, all the digits must be grouped and then mapped into letters using the following mapping:
...
For example, $$$\tt{"11106"}$$$ can be mapped into:
The first line of input contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$ — the number of testcases. The description of $$$t$$$ testcases follows.
The first and only line of each test case contains a string $$$S$$$ $$$(1 \le |S| \le 10^5)$$$ containing digits.
It is guaranteed that the sum of $$$|S|$$$ over all testcases does not exceed $$$10^5$$$.
For each testcase, print a single integer — the number of ways to decode the given string. As the answer can be rather large, print it modulo $$$10^9 + 7$$$.
442110112226
2 1 2 3
In sample test case 1, we can decode the given string as either "DU" or "DBA".
In sample test case 2, we can decode the given string only as "JA".
In sample test case 3, we can decode the given string as either "L" or "AB".
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.