Anti-Palindrome
Time limit1sMemory limit1024 MB
Given one line of text, decide whether it contains a palindrome of two or more letters after ignoring non-letters and case.
- Level
Easy2 of 10
- Topics
- String, Brute force
- Solved
- No attempts yet
Problem
A palindrome is a sequence of two or more characters that reads the same forward and backward. Palindromes can appear inside a longer text. For example, in "Happy days are here again.", "pp", "ehe", and "ere" are palindromes (spaces, punctuation, and case are ignored). An anti-palindrome is a sequence of two or more characters that contains no palindromes. You are given a text that may contain a palindrome or may itself be a palindrome. Determine whether the text contains any palindromes. The text may contain spaces, alphabetic characters, and other non-alphabetic characters. All non-alphabetic characters should be ignored, and uppercase and lowercase letters are treated as the same when detecting palindromes.
Input
The input consists of one line of text as described above. The line is at most 80 characters long and contains at least one alphabetic character.
Output
Print "Palindrome" if the text contains a palindrome or is itself a palindrome. Print "Anti-palindrome" if the text contains no palindromes.