If the current palindrome date is valid
if ( isValidDate ( day , month , year ) ) { System . out . print ( rev + str + "NEW_LINE"); } } } static String reverse ( String input ) { char [ ] a = input . toCharArray ( ) ; int l , r = a . length - 1 ; for ( l = 0 ; l < r ; l ++ , r -- ) { char temp = a [ l ] ; a [ l ] = a [ r ] ; a [ r ] = temp ; } return String . valueOf ( a ) ; }