Maximize the number of palindromic Strings | Python3 program for the above approach ; To check if there is any string of odd length ; If there is at least 1 string of odd length . ; If all the strings are of even length . ; Count of 0 's in all  the strings ; Count of 1 's in  all the strings ; If z is even and o is even then ans will be N . ; Otherwise ans will be N - 1. ; Driver code
def max_palindrome ( s , n ) : NEW_LINE INDENT flag = 0 ; NEW_LINE for i in range ( n ) : NEW_LINE INDENT if ( len ( s [ i ] ) % 2 != 0 ) : NEW_LINE INDENT flag = 1 ; NEW_LINE DEDENT DEDENT if ( flag == 1 ) : NEW_LINE INDENT return n ; NEW_LINE DEDENT z = 0 ; o = 0 ; NEW_LINE for i in range ( n ) : NEW_LINE INDENT for j in range ( len ( s [ i ] ) ) : NEW_LINE INDENT if ( s [ i ] [ j ] == '0' ) : NEW_LINE INDENT z += 1 ; NEW_LINE DEDENT else : NEW_LINE INDENT o += 1 ; NEW_LINE DEDENT DEDENT DEDENT if ( o % 2 == 0 and z % 2 == 0 ) : NEW_LINE INDENT return n ; NEW_LINE DEDENT else : NEW_LINE INDENT return n - 1 ; NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT n = 3 ; NEW_LINE s = [ "1110" , "100110" , "010101" ] ; NEW_LINE print ( max_palindrome ( s , n ) ) ; NEW_LINE DEDENT