Fix TRIM bug with multiple lines

(Originally authored by "CCX".)

Example code exhibiting the bug:

    >> trim "  x ^/"
    == "x x^/"  ;; Expected: "x^/"

The fix changes some variable names, to make the algorithm easier to
understand. head and tail are now trimmed first, because it is simpler
this way.

The fix was created by GitHub user "CCX" and submitted as pull request
rebol/r3#70. This commit is a slightly reworked version of the original:
trailing whitespace was removed and intra-file code style consistency
improved.

This fixes CureCode issue #1948.