VerkadaOA #1
Find Valid IP Addresses
估计简单可在线判题
考点(AI 标注)字符串
Recursively scan the whitespace-separated tokens in files under root, collect valid IPv4 addresses, and sort them lexicographically, keeping duplicates.
The standard input/output format and supplementary bounds on this site are as stated in this problem.
输入格式
The first line is the root path; the second line is the number of files f (≤2×10^5); each following line is path<TAB>content, where path is an absolute POSIX path, file contents contain no tabs, and the total number of characters is ≤10^6.
输出格式
One address per line; if there are no results, output nothing.
样例 1
输入:
/var/log
3
/var/log/a client 10.1.1.1 backup 256.1.1.1
/var/log/sub/b 192.168.0.1 01.2.3.4
/tmp/x 8.8.8.8
输出:
10.1.1.1
192.168.0.1
样例 2
输入:
/data
1
/database/a 1.1.1.1
输出:
样例 3
输入:
/data
7
/database/no ip 1.2.3.4 bad 01.2.3.4
/database/no 255.255.255.255 256.0.0.1
/data/sub/b ip 1.2.3.4 bad 01.2.3.4
/data/a ip 1.2.3.4 bad 01.2.3.4
/data/a repeat 1.1.1.1 1.1.1.1
/data/sub/b 255.255.255.255 256.0.0.1
/database/no repeat 1.1.1.1 1.1.1.1
输出:
1.1.1.1
1.1.1.1
1.2.3.4
1.2.3.4
255.255.255.255