[HNU 10058] Server

Server
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB
Total submit users: 1391, Accepted users: 1295
Problem 10058 : No special judgement
Problem description

Users of computers frequently enter URLs (Uniform Resource Locators) in the form

    protocol://server.network

For example, in the URL

    http://www.monkey.donkey.zebra.com

the protocol is "http", the server is "www", and the network is "monkey.donkey.zebra.com". For purposes of this problem, the protocol and server are alphanumeric strings, whereas the network is an alphanumeric string that may also contain periods (however, the URL cannot end with a period or contain two consecutive periods).


 
Input
Each line of the input contains a URL in the format specified above. No line will be longer than 80 characters. The input is terminated by end-of-file.
 
Output
Each line of input will give rise to one line of output, consisting of the word "server", followed by a colon and one blank space, and the server from the corresponding line of input.
 
Sample Input
http://www.monkey.donkey.zebra.com
ftp://newton.cs.colorado.edu
Sample Output
server: www
server: newton

 AC:

#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>


int main()
{
    int ch; int p = 0;
    while (~(ch = getchar())) 
    {
        if (ch == '/') ++p;
        else if (ch == '.' && p == 2) printf("\n"), p = 0;
        else if (p == 2) printf("%c", ch);
        if (p == 1) printf("server: ");
    }
    return 0;
}

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值