← Back to Strings
Question 53
Palindrome Ignoring Spaces
Palindrome Ignoring Spaces
Read one phrase in lower case and decide whether it is a palindrome once every space is ignored: print exactly Palindrome or exactly Not a palindrome. First build cleaned by looping over the phrase and adding only the characters that are not a space (!= tests for not equal), then compare the cleaned string with its reverse made by the slice [::-1]. Input: one line, the phrase, no prompt; it may contain spaces anywhere.
Expected Output:
Palindrome= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
StringsSlicing
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.