trying to write string reverse function