题库练习 Hostname Aliases
← 上一题 下一题 →

A10316 | Hostname Aliases

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

The first line of the input contains a single integer $n$ ( $1<=n<=100000$ ) — the number of page queries. Then follow $n$ lines each containing exactly one address. Each address is of the form http://<hostname>\[/<path>\], where:

- <hostname> consists of lowercase English letters and dots, there are no two consecutive dots, <hostname> doesn't start or finish with a dot. The length of <hostname> is positive and doesn't exceed $20$ .
- <path> consists of lowercase English letters, dots and slashes. There are no two consecutive slashes, <path> doesn't start with a slash and its length doesn't exceed $20$ .

Addresses are not guaranteed to be distinct.

输入格式

First print $k$ — the number of groups of server names that correspond to one website. You should count only groups of size greater than one.

Next $k$ lines should contain the description of groups, one group per line. For each group print all server names separated by a single space. You are allowed to print both groups and names inside any group in arbitrary order.

输出格式

无

输入输出样例

输入 #1
10
http://abacaba.ru/test
http://abacaba.ru/
http://abacaba.com
http://abacaba.com/test
http://abacaba.de/
http://abacaba.ru/test
http://abacaba.de/test
http://abacaba.com/
http://abacaba.com/t
http://abacaba.com/test
输出 #1
1
http://abacaba.de http://abacaba.ru 
输入 #2
14
http://c
http://ccc.bbbb/aba..b
http://cba.com
http://a.c/aba..b/a
http://abc/
http://a.c/
http://ccc.bbbb
http://ab.ac.bc.aa/
http://a.a.a/
http://ccc.bbbb/
http://cba.com/
http://cba.com/aba..b
http://a.a.a/aba..b/a
http://abc/aba..b/a
输出 #2
2
http://cba.com http://ccc.bbbb 
http://a.a.a http://a.c http://abc 
C++ 编辑器
输入
输出