Implemented below mentioned changes :

1. Added is_palindrome method to String class.
2. Optimized if else ladder