string reverse function build