Question: You are given a string S of length N . The string S consists of only lowercase English letters ( a , b , c

You are given a string S of length N. The string S consists of only lowercase English letters (a, b, c,...,2). You are also given an array A of size 26. You have to partition the given string into exactly K parts. A partition is called good if it holds the following conditions
1. String S should be partitioned into exactly K contiguous substrings, No substrings can be empty. 2. Each partition should contain a maximum A[0] number of occurrences of a' A[1] number of occurrences of '" so on A|25] occurrences of z
For example, consider string "aab", and A|0]=1, A|1]=1 and K =2( a ab is a good partition but aa I b is not a good partition)
You are required to count the number of the good partition of string S. Since_the _number of aood partitions _can be verv larae. print modulo

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!