Strings-count pallindromic strings

two test cases are failing and i know the reasons why…like

  1. it will give incoorect outp for the inp-aabc and many more like that.
    but i am unable to crack the right code…i tried as much as i can
    please help
    #include
    #include
    using namespace std;

void countpall(char a[]){
int len=strlen(a);
int i=0;
int j=1;
int cnt=0;
while(j<len){
if(a[i]!=a[j]){
i++;
if(i==j){

		j++;
		}
	}
	else{
	cnt++;
	j++;
	}

}

for(int i=0;i<len;i++){
	cnt++;
}
cout<<cnt;

}

int main() {
char a[1000];
cin.getline(a,1000);

countpall(a);

return 0;

}

hi @abhinavssr2003_eab0717682969e5c,
the logic is not correct

This problem is a advance part of the isPalindrome and print all subsets of a String.

Algo

// Write a Function to generate Substrings of all Length.
// Write a Function to check is the String is Palindrome or not.
// Pass each generated substring to palindrome and if returns true then print the string otherwise ignore.

refer here https://ide.codingblocks.com/s/661350

Will you please explain me what you did under main func??basically in line number 24…what is string s = “”;

hi @abhinavssr2003_eab0717682969e5c,
commented with eg please check https://ide.codingblocks.com/s/661350

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.