<s> __author__ = "<STR_LIT>" <EOL> def reverse_str_inplace ( _str ) : <EOL> if len ( _str ) < <NUM_LIT:2> : <EOL> return _str <EOL> return _str [ - <NUM_LIT:1> ] + reverse_str ( _str [ <NUM_LIT:1> : - <NUM_LIT:1> ] ) + _str [ <NUM_LIT:0> ] <EOL> def reverse_str ( _str ) : <EOL> result = '<STR_LIT>' <EOL> j = len ( _str ) - <NUM_LIT:1> <EOL> while j >= <NUM_LIT:0> : <EOL> result += _str [ j ] <EOL> return result <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> _str = '<STR_LIT>' <EOL> result = '<STR_LIT>' <EOL> assert ( reverse_str ( _str ) == result ) <EOL> assert ( reverse_str_inplace ( _str ) == result ) <EOL> _str = '<STR_LIT:a>' <EOL> result = '<STR_LIT:a>' <EOL> assert ( reverse_str ( _str ) == result ) <EOL> assert ( reverse_str_inplace ( _str ) == result ) <EOL> _str = '<STR_LIT>' <EOL> result = '<STR_LIT>' <EOL> assert ( reverse_str ( _str ) == result ) <EOL> assert ( reverse_str_inplace ( _str ) == result ) <EOL> _str = '<STR_LIT>' <EOL> result = '<STR_LIT>' <EOL> assert ( reverse_str ( _str ) == result ) <EOL> assert ( reverse_str_inplace ( _str ) == result ) </s>
