Trim the host name.

If the user type something like "google.com " the ping will not work. With this change, the host name is trimmed to remove this extra space.