101: Count palindromic substrings

Given a string, count how many palindromic substrings in the given string

 

Example 1

Input:   abc

Output:  3

Example 2

Input:   aaa

Output:  6

Explanation: a, a, a, aa, aa, aaa

Difficulty:Medium
Topic:StringTwo Pointers
Problem #:101