#K53697. Find Palindromic Words
Find Palindromic Words
Find Palindromic Words
You are given a string containing words separated by spaces. Your task is to find and print all the palindromic words in the order they appear in the input. A palindrome is a word that reads the same forwards and backwards. The comparison is case-sensitive, so 'Anna' is not considered a palindrome, while 'anna' is.
If there are no palindromic words, print None
.
Note: The input will be taken from standard input (stdin) and the output should be printed to standard output (stdout) in a single line with the palindrome words separated by a single space.
Examples:
- Input:
madam racecar apple level noon
→ Output:madam racecar level noon
- Input:
hello world example
→ Output:None
- Input:
wow anna civic
→ Output:wow anna civic
inputFormat
The input consists of a single line containing a string of words separated by spaces.
outputFormat
If there are any palindromic words, output them in the order they appear separated by a single space. If there are no palindromic words, output None
.
madam racecar apple level noon
madam racecar level noon