How to display a largest palindrome from a string.. | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

How to display a largest palindrome from a string..

i am giving an example.. Ex- user entered a string "racemammacar" here in this example we have two plaindromes 'mam' and 'amma' now we have to find those palindrome and print the longest of the two....plz help me..

16th Jan 2017, 1:39 PM
Mohd Sabahat
Mohd Sabahat - avatar
2 ответов
+ 1
First go through your array of chars and test whether char[i-1] and char[I+1] are equal when they are try i-2 and i+2. When not store it in a string array or string vector. After you are completely through the input array go through your result array created in the description above. And search for the longest result. At the end print longest result.
16th Jan 2017, 2:30 PM
Andreas K
Andreas K - avatar
+ 1
can you provide me with the code
20th Jan 2017, 2:46 PM
Mohd Sabahat
Mohd Sabahat - avatar