You are given a string \(S\) of length \(N\). You are also given an integer \(K\). The string consists of digits from \(1-9\) only. Determine the number of ways to partition the string \(S\) such that each segment value is less than \(K\).
If there is no way to perform partition on the string, then print \(0\).
Since the answer could be a large, print the answer as \(10^9+7\).
Input format
- First line: of input contains a single integer T denoting the number of test cases.
- For each test case:
- First line: Two space-separated integers \(N\) and \(K\)
- Second line: A string \(S\) of size \(N\)
Output format
Print the required answer.
Constraints
In first testcase, We have only one way to partition i.e 3,4,2,1,2.
In second testcase, we can partition in it two ways: 1,1 and 11
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor