AlgoUniversity
  • Go Back
Discussion
Palindromic Counter :

Author

Akshay Sharma

Difficulty Level : Medium

Submissions : 344

Asked In : Goldman-Sachs

Marks :100

: 7 | : 0

A palindromic is a string that reads the same from the left and from the right. For example, mom and tacocat are palindromes, as are any single characters string .Given a string determines the number if substrings that are palindromes.

Input

The first line of input contains a string s .($$$1 \le S \le 5000$$$)

Output

For each test case print the number of palindromes substring

Example

Input
tacocat
Output
10

Note

Example:

The string is s=tacocat. Palindromic substrings are [t,a,c,o,c,a,t,coc,acoca,tacocat].

There are total of 10 palindromic substrings.

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.