P19950 [GeeksforGeeks] 839d6ba2c2e4c669ba9d9d9f32ad20118937284e
普及-
题目描述

Given a string S. The task is to count the number of substrings which contains equal number of lowercase and uppercase letters.
Example 1:
Input:
S = "gEEk"
Output: 3
Explanation: There are 3 substrings of
the given string which satisfy the
condition. They are "gE", "gEEk" and "Ek".
Example 2:
Input:
S = "WomensDAY"
Output: 4
Explanation: There are 4 substrings of
the given string which satisfy the
condition. They are "Wo", "ensDAY",
"nsDA" and "sD"
Your Task:
The task is to complete the function countSubstring() which takes the string S as input parameter and returns the number of substrings which contains equal number of uppercase and lowercase letters.
Expected Time Complexity: O(N*N)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ |S| ≤ 10^{3}

输入格式

见题面

输出格式

见题面

样例输入
S = "gEEk"
样例输出
3