/cascading-palindrome

This script defines a class CascadingPalindrome that helps you find the longest cascading palindrome within a given input string. A cascading palindrome is a sequence of words that forms a palindrome when read consecutively.

Primary LanguagePythonMozilla Public License 2.0MPL-2.0

Cascading Palindrome Finder

This script defines a class CascadingPalindrome that helps you find the longest cascading palindrome within a given input string. A cascading palindrome is a sequence of words that forms a palindrome when read consecutively.

How It Works

The CascadingPalindrome class contains methods to check for palindromes and find the longest cascading palindrome in an input string. The main() function is the entry point of the script, which takes user input, validates it, and then displays the result.

Usage

  1. Run the script by executing it in a Python environment:
python cascading_palindrome.py

Example 1

$ python cascading_palindrome.py
Enter the input string: racecar wow anna sees radar
The cascading palindrome is: racecar wow anna sees

Example 2

$ python cascading_palindrome.py
Enter the input string: hello world python cascading
There is no cascading palindrome in the input string.