{"id":17545,"date":"2021-08-26T10:42:25","date_gmt":"2021-08-26T05:12:25","guid":{"rendered":"https:\/\/python-programs.com\/?p=17545"},"modified":"2021-11-22T18:37:12","modified_gmt":"2021-11-22T13:07:12","slug":"python-program-to-count-non-palindrome-words-in-a-sentence","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-count-non-palindrome-words-in-a-sentence\/","title":{"rendered":"Python Program to Count Non Palindrome words in a Sentence"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Find Leaders in an Array\/List<\/a>
\nGiven a string and the task is to count all the Non-palindromic words in a given sentence.<\/p>\n

Palindrome:<\/strong><\/p>\n

If the reverse of a string is the same as the string, it is said to be a palindrome.<\/p>\n

Example :<\/p>\n

Given string = “sos asked to bring the madam “.<\/p>\n

Output :<\/p>\n

Explanation: In this “madam”, “sos” are the palindromic words. By sorting them we get {“madam”,”sos”}<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given String = \"dad and mom both ordered to bring sos in malayalam\"<\/pre>\n

Output:<\/strong><\/p>\n

The count of all the Non-palindromic words in a given sentence = 6<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given String = \"My mom and dad treats me in equal level\"<\/pre>\n

Output:<\/strong><\/p>\n

The count of all the Non-palindromic words in a given sentence = 6<\/pre>\n

Program to Count Non-Palindrome words in a Sentence<\/h2>\n

Below are the ways to count all the Non-palindromic words in a given sentence.<\/p>\n