In this Kata, you will create a function that converts a string with letters and numbers to the inverse of that string (with regards to Alpha and Numeric characters). So, e.g. the letter `a` will become `1` and number `1` will become `a`; `z` will become `26` and `26` will become `z`.

Example: `"a25bz"` would become `"1y226"`


Numbers representing letters (`n <= 26`) will always be separated by letters, for all test cases: 

* `"a26b"` may be tested, but not `"a262b"`
* `"cjw9k"` may be tested, but not `"cjw99k"`

A list named `alphabet` is preloaded for you: `['a', 'b', 'c', ...]`

A dictionary of letters and their number equivalent is also preloaded for you called `alphabetnums = {'a': '1', 'b': '2', 'c': '3', ...}`

Source: codewars | Difficulty: EASY
Tags: String algorithms

Starter code: def AlphaNum_NumAlpha(string):
	

Solutions:
import re

def AlphaNum_NumAlpha(string):
	return re.sub('[0-9]{1,2}|[a-z]', lambda x: str(ord(x.group()) - 96) if x.group().isalpha() else chr(int(x.group()) + 96), string)


import re
from string import ascii_lowercase

def repl(m):
	x = m.group()
	if x.isdigit():
		return ascii_lowercase[int(x) - 1]
	else:
		return str(ascii_lowercase.find(x) + 1)

def AlphaNum_NumAlpha(string):
	return re.sub('[a-z]|\\d+', repl, string)


import re

def AlphaNum_NumAlpha(string):
	return ''.join((chr(int(e) + 96) if e.isdigit() else str(ord(e) - 96) for e in re.split('([a-z])', string) if e))


import re

def AlphaNum_NumAlpha(string):
	f = lambda x: str(ord(x) - ord('a') + 1) if x.isalpha() else chr(ord('a') + int(x) - 1)
	return ''.join([f(x) for x in re.findall('\\d{1,2}|[a-z]', string)])