Student A and student B are giving each other test answers during a test.  
They don't want to be caught so they are sending each other coded messages.

Student A is sending student B the message: `Answer to Number 5 Part b`.  
He starts of with a square grid (in this example the grid = 5x5).  
He writes the message down (with spaces):

```
Answe
r to 
Numbe
r 5 P
art b
```

He then starts writing the message down one column at a time (from the top to the bottom).  
The new message is now: `ArNran u rstm5twob  e ePb`

You are the teacher of this class.  
Your job is to decipher this message and bust the students.

# Task

Write a function `decipher_message`.  
This function will take one parameter (`message`).  
This function will return the original message.  
*** Note: The length of the string is always going to be a prefect square ***

Hint: You should probably decipher the example message first before you start coding

Have fun !!!

Source: codewars | Difficulty: EASY
Tags: String algorithms

Starter code: def decipher_message(message):
	

Solutions:
def decipher_message(message):
	n = int(len(message) ** 0.5)
	return ''.join((message[i::n] for i in range(n)))


from math import sqrt

def decipher_message(message):
	key = int(sqrt(len(message)))
	plaintext = [''] * key
	current_row = 0
	for symbol in message:
		plaintext[current_row] += symbol
		current_row += 1
		if current_row > key - 1:
			current_row = 0
	return ''.join(plaintext)


import math

def decipher_message(m):
	l = int(math.sqrt(len(m)))
	return ''.join((''.join((m[i + l * j] for j in range(l))) for i in range(l)))


def decipher_message(message):
	if not message:
		return ''
	res = []
	for i in range(0, len(message), int(len(message) ** 0.5)):
		res.append(message[i:i + int(len(message) ** 0.5)])
	solution = ''
	for i in range(len(res)):
		for j in range(len(res[i])):
			solution += res[j][i]
	return solution


def decipher_message(message):
	from math import sqrt
	if len(message) == 0:
		return message
	else:
		(lists, output) = ([], [])
		x = int(sqrt(len(message)))
		for i in range(0, len(message), x):
			lists.append(list(message[i:i + x]))
		for i in range(len(lists)):
			for j in range(len(lists)):
				output.append(lists[j][i])
		return ''.join(output)


def decipher_message(message):
	if not message:
		return ''
	s = int(len(message) ** 0.5)
	l = [message[i:i + s] for i in range(0, len(message), s)]
	r = []
	for i in range(s):
		r.append(''.join(list(map(lambda x: x[i], l))))
	return ''.join(r)


def decipher_message(m):
	Q = int(len(m) ** 0.5)
	return ''.join((''.join(i) for i in zip(*[m[i:i + Q] for i in range(0, len(m), Q)]))) if m else ''