fix optimization issues
check whether the input string is palindrome or not