Count all Palindrome Sub-Strings in a String in C++

In this tutorial, we will be discussing a program to find the number of palindrome sub strings in a string.

For this we will be given a string. Our task is to count the number of palindrome sub strings in the given string with length greater than 3.

Example

#include
using namespace std;
//counting palindrome strings
int count_pstr(char str[], int n){
   int dp[n][n];
   memset(dp, 0, sizeof(dp));
   bool P[n][n];
   memset(P, false , sizeof(P));
   for (int i= 0; i

Output

3
Updated on: 2020-02-10T11:13:53+05:30

248 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements