reverse each node data
def reverse_word ( str ) : NEW_LINE INDENT s = " " NEW_LINE i = 0 NEW_LINE while ( i < len ( str ) ) : NEW_LINE INDENT s = str [ i ] + s NEW_LINE i = i + 1 NEW_LINE DEDENT return s NEW_LINE DEDENT def reverse ( head ) : NEW_LINE INDENT ptr = head NEW_LINE DEDENT