Trim leading and trailing whitespace from input