```
def countSubstrings(self, s):
if not s:
return 0
count = 0
for i in range(len(s)):
for j in range(2):
# count number of palindrome substrings centered at i
count += self.helper(s, i, i + j)
return count
def helper(self, s, i, j):
count = 0
while i >= 0 and j < len(s) and s[i] == s[j]:
count += 1
i -= 1
j += 1
return count
```