Check given string is oddly palindrome or not | Function to check if the string str is palindromic or not ; Iterate the string str from left and right pointers ; Keep comparing characters while they are same ; If they are not same then return false ; Return true if the string is palindromic ; Function to make string using odd indices of string str ; Functions checks if characters at odd index of the string forms palindrome or not ; Make odd indexed string ; Check for Palindrome ; Given string ; Function call
def isPalindrome ( str ) : NEW_LINE INDENT l = 0 ; NEW_LINE h = len ( str ) - 1 ; NEW_LINE while ( h > l ) : NEW_LINE INDENT if ( str [ l ] != str [ h ] ) : NEW_LINE INDENT return False ; NEW_LINE DEDENT l += 1 NEW_LINE h -= 1 NEW_LINE DEDENT return True ; NEW_LINE DEDENT def makeOddString ( str ) : NEW_LINE INDENT odd = " " ; NEW_LINE for i in range ( 1 , len ( str ) , 2 ) : NEW_LINE INDENT odd += str [ i ] ; NEW_LINE DEDENT return odd ; NEW_LINE DEDENT def checkOddlyPalindrome ( str ) : NEW_LINE INDENT odd = makeOddString ( str ) ; NEW_LINE if ( isPalindrome ( odd ) ) : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT DEDENT str = " ddwfefwde " ; NEW_LINE checkOddlyPalindrome ( str ) ; NEW_LINE