Given a string str, the task is to print longest palindrome word present in the string str.
Input : Madam Arora teaches Malayalam
Explanation: The string contains three palindrome words (i.e., Madam, Arora, Malayalam) but the length of Malayalam is greater than the other two.
Input : Welcome to GeeksforGeeks
Output : No Palindrome Word
Explanation:The string does not contain any palindrome word so the output is No Palindrome Word.
- longestPalin() function finds the longest palindrome word by extracting every word of the string and passing it to checkPalin() function. An extra space is added in the original string to extract last word.
- checkPalin() function checks if the word is palindrome. It returns true if word is palindrome else returns false. It makes sure that empty strings are not counted as palindrome as the user may enter more than one spaces in between or at the beginning of the string.
- Program for length of the longest word in a sentence
- Print each word in a sentence with their corresponding average of ASCII values
- Sentence Palindrome (Palindrome after removing spaces, dots, .. etc)
- Longest Common Prefix using Word by Word Matching
- Check if a word is present in a sentence
- Sums of ASCII values of each word in a sentence
- Program to replace a word with asterisks in a sentence
- Java program to count the characters in each word in a given sentence
- Count palindrome words in a sentence
- Next word that does not contain a palindrome and has characters from first k
- Longest Possible Chunked Palindrome
- Length of the longest substring that do not contain any palindrome
- Longest palindrome subsequence with O(n) space
- Longest double string from a Palindrome
- Print given sentence into its equivalent ASCII form
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.