Blue Bridge Cup title
Uniform Resource Locator
Title Description
Uniform Resource Locator (Uniform Resource Locator, abbreviated as URL) is a compact representation to one location and access methods can be obtained from the Internet resources, the standard is the address of a resource on the Internet. Each file on the Internet has a unique URL, which contains information indicates that the file location and the browser should be how to deal with it.
A typical URL syntax should be as follows:
scheme: // Domain: Port / path the QUERY_STRING # fragment_id?
In this problem mode / protocol (scheme) and domain name (domain) is necessary others are optional.
For example, the following contains some correct the URL of:
http://dict.bing.com.cn/# decimal point
http://www.mariowiki.com/Mushroom
https://mail.google.com/mail/?shva=1# Inbox
http://en.wikipedia.org/wiki/Bowser_(character)
http://fync.acmclub.com/
ftp://222.207.30.4/
http://www.int255.com:8080/bbs/
now your task is to find out the domain name from the given URL.
Entry
Multiple sets of test cases, each URL on its own line, please read the end of the file.
Export
For each test case, you should output given the URL of the domain name, each output on its own line.
Sample input
http://dict.bing.com.cn/# decimal point
http://www.mariowiki.com/Mushroom
https://mail.google.com/mail/?shva=1#inbox
Sample Output
dict.bing.com.cn
www.mariowiki.com
mail.google.com
Program source code
#include<stdio.h>
#include<string.h>
int main()
{
int i,d;
char str[10000];
while(scanf("%s",str)!=EOF) //多次输入url
{
flage=0; //设置标志flage
for(i=0;str[i]!='\0';i++)
{
if(!flage)
{
if(str[i]=='/'&&str[i-1]=='/')
flage=1; //找到域名的开始
}
else
{if(str[i]==':'||str[i]=='/') //判断域名输出结束
break;
printf("%c",str[i]); //输出域名
}
}
printf("\n");
}
return 0;
}