Middle Characters

Middle Characters

You are given some string where you need to find its middle character(s). The string may contain one word, a few symbols or a whole sentence. If the length of the string is even, then you should return two middle characters, but if the length is odd, return just one. For more details look at the Example.

example

If you want to practice more with the similar case, try Median mission.

Input: A string (str).

Output: The middle character(s) as string (str).

Examples:

assert middle("example") == "m"
assert middle("test") == "es"

How it is used: for work with texts.

Precondition: 1 <= the length of the text <= 100.