Question: Write a program to find the largest palindrome in a string. A palindrome is a sequence that reads the same backward as forward. raceear, eve,
Write a program to find the largest palindrome in a string. A palindrome is a sequence that reads the same backward as forward. raceear, eve, kayak are some examples.
For this assignment implement the following function
int palindromelength(char *str, int i, int j)
This function takes a string str and two points i and j and determines whether the string from i to j is a palindrome. If it is a palindrome, it returns the length of the palindrome and if it is not a palindrome, it returns -1.
Consider the following string as an example
ABCBAHELLOHOWRACECARAREYOUIAMAIDOINEVERODDOREVENNGGOOD
It has many palindromes in it including ABCBA, RACECAR, ARA, IAMAL Largest palin-drome is NEVERODDOREVEN since it has the most characters in it. Sample execution is given below
Enter a string
ABCBACDCBAAB
Largest palindrome is ABCBA
Step by Step Solution
3.42 Rating (152 Votes )
There are 3 Steps involved in it
To solve the problem of finding the largest palindrome in a string we need to implement the palindromelength function and a main function that examine... View full answer
Get step-by-step solutions from verified subject matter experts
