# Do you speak retsec?
You and your friends want to play undercover agents. In order to exchange your *secret* messages, you've come up with the following system: you take the word, cut it in half, and place the first half behind the latter. If the word has an uneven number of characters, you leave the middle at its previous place:

![retsec examples](http://i.imgur.com/Ozy6p09.png)

That way, you'll be able to exchange your messages in private.

# Task
You're given a single word. Your task is to swap the halves. If the word has an uneven length, leave the character in the middle at that position and swap the chunks around it.

## Examples
```python
reverse_by_center("secret")  == "retsec" # no center character
reverse_by_center("agent")   == "nteag"  # center character is "e"
```

## Remarks
Don't use this to actually exchange messages in private.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def reverse_by_center(s):
	

Solutions:
def reverse_by_center(s):
	n = len(s) // 2
	return s[-n:] + s[n:-n] + s[:n]


import re

def reverse_by_center(s):
	half = len(s) // 2
	return re.sub('(.{%s})(.?)(.{%s})' % (half, half), '\\3\\2\\1', s)


def reverse_by_center(s):
	(q, r) = divmod(len(s), 2)
	return s[-q:] + s[q:q + r] + s[:q]


def reverse_by_center(s):
	m = len(s) // 2
	return s[m:] + s[:m] if len(s) % 2 == 0 else s[m + 1:] + s[m] + s[:m]


def reverse_by_center(s):
	n = len(s)
	m = n >> 1
	if n % 2:
		return s[m + 1:] + s[m] + s[:m]
	return s[m:] + s[:m]


def reverse_by_center(s):
	mid = len(s) // 2
	if len(s) % 2 == 0:
		return s[mid:] + s[:mid]
	return s[mid + 1:] + s[mid] + s[:mid]


def reverse_by_center(s):
	l = len(s) // 2
	if len(s) % 2 == 0:
		return s[l:] + s[:l]
	else:
		return s[l + 1:] + s[l] + s[:l]


def reverse_by_center(s):
	half = len(s) // 2
	return s[-half:] + s[half:-half] + s[:half]