easyUnit 3 · Strings
P7. Palindrome Checker
Strings
A palindrome reads the same forwards and backwards. Read a line of text, keep only its letters and digits, convert it to lowercase, and check whether the result is a palindrome.
Input Format
- Line 1: a line of text
Output Format
- Line 1:
Cleaned: <cleaned text> - Line 2:
PalindromeorNot a palindrome
Constraints
- 1 ≤ length of the text ≤ 200
- The text contains at least one letter or digit
Sample Test Cases
Sample 1
Input
Madam
Output
Cleaned: madam Palindrome
Sample 2
Input
A man, a plan, a canal: Panama
Output
Cleaned: amanaplanacanalpanama Palindrome
Submitting checks 2 sample cases and 4 hidden test cases.