-->
当前位置:首页 > 题库

PROGRAMMING:IP geometry

Luz5年前 (2021-05-10)题库358
Please write a program to split a string composed only of numbers into possible IP address forms (you can think that it is helping the public security personnel to crack the hidden IP address). The IP address is composed of four integers separated by dots. The value of each integer is between 0 and 255. Except for zero, other integers have no leading zeros.
###Input sample 1:
A string consisting only of numbers 0-9.
```in
twenty-five billion five hundred and twenty-five million five hundred and ten thousand one hundred and thirty-five
```
###Output sample 1:
Output possible IP addresses in a pair of {} separated by commas.
```out
{255.255.10.135,255.255.101.35}
```
###Input sample 2:
A string consisting only of numbers 0-9.
```in
0012
```
###Output sample 2:
Output possible IP addresses in a pair of {} separated by commas.
```out
{0.0.1.2}
```
###Input sample 3:
A string consisting only of numbers 0-9.
```in
00255256
```
###Output sample 3:
Output possible IP addresses in a pair of {} separated by commas. If it is impossible to form IP address, output a pair of empty {}.
```out
{}
```






answer:If there is no answer, please comment