## Welcome to my (amazing) kata!

You are given a gigantic number to decode.  Each number is a code that alternates in a pattern between encoded text and a smaller, encoded number.  The pattern's length varies with every test, but the alternation between encoded text and an encoded number will always be there.  Following this rule, each number tested begins with encoded text and ends with an encoded number.

## How the encoding works

Now, we should probably review how the string of numbers is formed - considering you have to unform it. So, first, some text is taken, and encoded.  The system of encoding is taking each letter's position in the alphabet and adding 100 to it.  For example, `m` in the real text would be `113` in the code-number.

After the text, there is a binary number.  You should convert this number to a normal, base 10 decimal (all of them can be converted into whole, non-negative numbers).

Separating encoded text and encoded numbers, there is a `98`.  Because the numbers are in binary, the only digits they use are '0' and '1', and each letter of the alphabet, encoded, is between 101-127, all instances of `98` are to indicate a separation between encoded text and encoded numbers.  There may also be a `98` at the very end of the number.

When you return your final answer, the text and numbers should always be separated by a comma (`,`)

## Example

```python
decode(103115104105123101118119981001098113113113981000) = "codewars, 18, mmm, 8"
```
The part of the code until the first `98` can be decoded to `"codewars"`.  `10010` is binary for `18`. `113113113` translates to `"mmm"`.  And `1000` is binary for `8`.

Here is a visualisation of the example:

Good luck!

Difficulty: introductory

Starter code:

def decode(number):
	

Solutions:
def decode(number):
    return ', '.join(
        str(int(w, 2)) if i % 2 else
        ''.join( chr(int(w[x:x+3])-4) for x in range(0, len(w), 3) )
        for i, w in enumerate( str(number).strip('98').split('98') )
        )

def decode(number):
    split = str(number).replace('98', ' ').split()
    split[::2] = [''.join(chr(int(w[i: i+3]) - 4)
                          for i in range(0, len(w), 3))
                              for w in split[::2]]
    split[1::2] = [str(int(n, 2)) for n in split[1::2]]
    return ', '.join(split)

def decode(number):
    import textwrap
    arr=[]
    for x in str(number).split('98'):
        if x:
            try:
                arr.append(str(int(x,2)))
            except:
                arr.append("".join([chr(int(x)-4) for x in textwrap.wrap(x,3)]))
    return ", ".join(arr)

from re import compile

FIND = compile(r"((?:\d{3})+?)(?:98)([01]+)(?:98)?").findall
to_text = lambda s: ''.join(chr(int(s[i:i+3]) - 4) for i in range(0, len(s), 3))

def decode(number):
    return ', '.join(f"{to_text(x)}, {int(y, 2)}" for x,y in FIND(str(number)))

def decode(s):
    arr = str(s).strip('98').split('98')
    return ', '.join(sum([[''.join([chr(96+int(arr[i][k:k+3])-100) for k in range(0,len(arr[i]),3)]),str(int(arr[i+1],2))] for i in range(0,len(arr),2)],[]))

def decode(number):
    parts = str(number).rstrip('98').split('98')
    parts[::2] = (''.join(chr(0x60 + int(b+c)) for _, b, c in zip(*[iter(part)]*3)) for part in parts[::2])
    parts[1::2] = (str(int(part, 2)) for part in parts[1::2])
    return ', '.join(parts)

def decode(number):
    parts = [e for e in str(number).split('98') if e]
    return ', '.join(str(int(w, 2)) if i % 2 else word(w) for i, w in enumerate(parts))
        
def word(s):
    return ''.join(chr(int(s[i*3:i*3+3]) - 4) for i in range(len(s) // 3))        

def decode(number):
    foo = str(number).split('98')
    parts = foo[:-1] if foo[-1] == '' else foo
    output = ""
    for i in range(len(parts)):
        if i % 2 == 0:
            for x in range(0, len(parts[i]), 3):
                output += chr(int(parts[i][x:x+3])-4)
            output += ', '
        else:
            output += str(int(parts[i], 2))
            if i != len(parts)-1:
                output += ', '
    return output
    


def decode(number):
    string = str(number).split('98')
    if not string[-1]: del(string[-1])
    let = []
    for x in range(len(string)):
        if not x%2:
            let_n=[]
            for y in range(0, len(string[x])-2, 3):
                let_n.append(chr(int(string[x][y:y+3])-4))
            let.append(''.join(let_n))
        else: let.append(str(int(string[x],2)))
    return ', '.join(let)

import re
def decode(number):
    arr = []
    for match in re.finditer(r'((?:1[01][1-9]|110|12[0-7])+)98([01]+)(?:98)?', str(number)):
        arr.append(re.sub(r'\d{3}', lambda m: chr(int(m.group()) - 4), match.group(1)))
        arr.append(str(int(match.group(2), 2)))
    return ', '.join(arr)