A sorted string
You are given a string of length . The string contains only '', '', and ''.
Your task is to find the count of substrings in string that have . Print .
Here, denotes the frequency of occurrence of character in the string.
Input format
- The first line contains an integer that denotes the length of the string.
- The next line contains string .
Output format
Print the count of substrings in string that have modulus .
Constraints
Explanation
There are total 11 substrings in which . These are:
['a','ab', 'abccaa', 'abccaab', 'a', 'a', 'aa', 'ab', 'aab', 'caa', 'caab']
Note:- Partially Solved TIME EXTENDED
Comments
Post a Comment
Please give us your valuable feedback