Tired of those repetitive javascript challenges? Here's a unique hackish one that should keep you busy for a while ;)

There's a mystery function which is already available for you to use. It's a simple function called `mystery`. It accepts a string as a parameter and outputs a string. The exercise depends on guessing what this function actually does.

You can call the mystery function like this:

```python
my_output = mystery("my_input")
```

Using your own test cases, try to call the mystery function with different input strings and try to analyze its output in order to guess what is does. You are free to call the mystery function in your own test cases however you want.

When you think you've understood how my mystery function works, prove it by reimplementing its logic in a function that you should call 'solved(x)'. To validate your code, your function 'solved' should return the same output as my function 'mystery' given the same inputs.

Beware! Passing your own test cases doesn't imply you'll pass mine.

Cheaters are welcome :)

Have fun!

---

Too easy? Then this kata will totally blow your mind:

http://www.codewars.com/kata/mystery-function-number-2

Source: codewars | Difficulty: EASY
Tags: Ad-hoc

Starter code: def solved(string):
	

Solutions:
def solved(s):
	if len(s) & 1:
		s = s[:len(s) // 2] + s[len(s) // 2 + 1:]
	return ''.join(sorted(s))


def solved(string):
	b = str((len(string) - 1) / 2)
	b = int(b[:-2])
	if len(string) % 2 == 1:
		c = string[:b] + string[b + 1:]
		return ''.join(sorted(c))
	return ''.join(sorted(string))


solved = lambda s: ''.join(sorted(s[:len(s) // 2] + s[len(s) // 2 + int(len(s) & 1):]))


import os
os.putenv('SHELL', '/bin/bash')
os.system('echo "eCA9IGV2YWw=" |base64 -d> x.py')
import x

def solved(string):
	return x.x('m' + 'ystery(' + repr(string) + ')')


import importlib
built_ins = importlib.import_module('b' + 'uiltins')

def solved(string):
	return vars(built_ins).get('e' + 'val')('m' + "ystery('" + string + "')")


def solved(s):
	return ''.join(sorted(s if len(s) % 2 == 0 else s[:len(s) // 2] + s[len(s) // 2 + 1:]))


def solved(string):
	l = len(string)
	if l % 2 == 1:
		string = string[0:l // 2] + string[1 + l // 2:]
	return ''.join(sorted(string))


def solved(s):
	l = len(s)
	s = s[0:l // 2] + s[l // 2 + 1:] if l % 2 else s
	s = list(s)
	s.sort()
	return ''.join(s)


def solved(string):
	n = len(string)
	return ''.join(sorted(string[:n // 2] + string[n // 2 + n % 2:]))