Problem title
Difficulty
Avg time to solve

Find the minimum cost to reach destination using a train
Moderate
20 mins
Find Division Upto Given Decimal Places
Easy
15 mins
Maximum length sub-array having absolute difference of adjacent elements either 0 or 1.
Easy
15 mins
Underground Explorer
Moderate
20 mins
Permutation Coefficient
Moderate
15 mins
Similar Strings
Easy
20 mins
Length of the longest substring with the equal number of 1s and 0s.
Moderate
30 mins
Minimum Window Substring
Hard
15 mins
Count Ways To Travel Triangular Pyramid
Moderate
20 mins
Maximum value of modulus expression
Moderate
10 mins
1

# Palindromes And Indexes

Difficulty: MEDIUM
Contributed By
Avg. time to solve
50 min
Success Rate
44%

Problem Statement

#### Note: A substring is a contiguous non-empty segment of the string.

##### For example:
``````String S = ababa
Index i = 1
len = 3

The answer to the above test case is 2 since there are two substrings that start at index 1 (1 - based indexing) - “aba”, “ababa”. Both these have a length of at least 3.
``````
##### Input Format:
``````The first line contains a single integer ‘T’ denoting the number of test cases to be run. Then the test cases follow.

The first line of each test case contains the string S.

The next line contains 2 space-separated integers denoting index ‘i’ and length ‘len’.
``````
##### Output Format:
``````For each test case, print an integer denoting the number of possible strings.

Output for each test case will be printed in a separate line.
``````
##### Note:
``````You are not required to print anything; it has already been taken care of. Just implement the function.
``````
##### Constraints:
``````1 <= T <= 10
1 <= |S| <= 10^4
1 <= i, len <= N

Time Limit: 1 sec.
``````
##### Sample Input 1:
``````2
ababa
1 3
abaaa
2 2
``````
##### Sample Output 1:
``````2
0
``````
##### Explanation For Sample Output 1:
``````For the first test case aba, ababa are the two palindromic substrings.

For the second test case there are no palindromic substrings of length greater than 2 beginning with 2nd index.
``````
##### Sample Input 2:
``````2
aaaaa
3 1
abc
3 3
``````
##### Sample Output 2:
``````3
0
``````
Console