This is the output I have now. How can I get from Input to Output?

Input:

```
1.2.3.4.5
2.3.4.5.6
```

Output:

```
1.2.3.4-5
2.3.4.5-6
```

Bonus: I have the other 80% of the script done but this is my ideal output. Is there a super simple way to do it?

Input:

```
1.2.3.4-1.2.3.10
```

Output:

```
1.2.3.4-10
```