You have a collection of lovely poems. Unfortuantely they aren't formatted very well. They're all on one line, like this:

```
Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated.
```
What you want is to present each sentence on a new line, so that it looks like this:
```
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
```
Write a function, `format_poem()` that takes a string like the one line example as an argument and returns a new string that is formatted across multiple lines with each new sentence starting on a new line when you print it out.

Try to solve this challenge with the [str.split()](https://docs.python.org/3/library/stdtypes.html#str.split) and the [str.join()](https://docs.python.org/3/library/stdtypes.html#str.join) string methods.

Every sentence will end with a period, and every new sentence will have one space before the previous period. Be careful about trailing whitespace in your solution.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def format_poem(poem):
	

Solutions:
def format_poem(poem):
	return '.\n'.join(poem.split('. '))


def format_poem(poem):
	return poem.replace('. ', '.\n')


from re import sub

def format_poem(poem):
	return sub('(?<=\\.)\\s', '\n', poem)


format_poem = lambda p: '.\n'.join(p.split('. '))


format_poem = __import__('functools').partial(__import__('re').sub, '(?<=\\.)\\s', '\n')


def format_poem(s):
	(a, r) = (s.split('.'), [])
	for (k, i) in enumerate(a):
		if k == 0:
			r.append(i.lstrip())
		else:
			r.append('\n' + i.lstrip())
	return '.'.join(r).rstrip('\n')