In the early nineties, the World Wide Web (WWW) was invented. Nowadays, most people think that the WWW simply consists of all the pretty (or not so pretty) HTML-pages that you can read with your WWW browser. But back then, one of the main intentions behind
the design of the WWW was to unify several existing communication protocols.
Then (and even now), information on the Internet was available via a multitude of channels: FTP, HTTP, E-Mail, News, Gopher, and many more. Thanks to the WWW, all these services can now be uniformly addressed via URLs (Uniform Resource Locators). The syntax
of URLs is defined in the Internet standard RFC 1738. For our problem, we consider a simplified version of the syntax, which is as follows:
<protocol> "://" <host> [ ":" <port> ] [ "/" <path> ]
The square brackets [] mean that the enclosed string is optional and may or may not appear. Examples of URLs are the following:
http://www.informatik.uni-ulm.de/acm
ftp://acm.baylor.edu:1234/pub/staff/mr-p
gopher://veryold.edu
More specifically,
<protocol> is always one of http, ftp or gopher.
<host> is a string consisting of alphabetic (a-z, A-Z) or numeric (0-9) characters and points (.).
<port> is a positive integer, smaller than 65536.
<path> is a string that contains no spaces.
You are to write a program that parses an URL into its components.