I have made the following C++ code, It tells me if a String is Palindrome or not. How do I make it to work that it tells me how many different Palindromes are there in the string. Again I don't know any high level coding. Please tell the solution which is appropriate for a beginner. I know the fucntions of the following header files only: iostream, conio, stdio,math, string(only strcpy and strcmp)
Example: //The Output of the Present code:
Enter String: DAD
It is a Pallindrome
OR
Enter String: DAP
It is not a Palindrome
//what i want to make it to:
Enter String: DAD MOM POP
Number of Palindromes - 3
OR
Enter String: DAK LAKE
Number of Palindromes -0
remember that:
- every string of length 1 is a palindrome i.e. a is palindrome, b is palindrome, ...
- a palindrome is a string of palindromes i.e. aba is a string containing a, b, aba
racecar is a string containing a, c, e, r, cec, aceca, racecar, ...
It does look like the OP actually wants to type a list of words and expects as result the number of words that are palindromes. That is different from dissecting a word to substrings. "foo abba oof" contains one: "abba".