This is a spin off of my first [kata](http://www.codewars.com/kata/56bc28ad5bdaeb48760009b0). You are given a list of character sequences as a comma separated string. Write a function which returns another string containing all the character sequences except the first and the last ones, separated by spaces. If the input string is empty, or the removal of the first and last items would cause the string to be empty, return a null value.

Difficulty: introductory

Starter code:

def array(string):
	

Solutions:
def array(strng):
    return ' '.join(strng.split(',')[1:-1]) or None


def array(s):
    r = ' '.join(s.split(',')[1:-1])
    return r if r else None

def array(string):
  res = ' '.join(string.split(',')[1:-1])
  return res if len(res) > 0 else None

def array(string):
    if len(string) <5:
      return None
    var =  string.split(',')
    var = var[1:-1]
    s = "";
    for i in var :
        s +=str(i)+" "
    if s[:-1] == '': 
      return None
    return s[:-1]

def array(str):
    l = len(str) > 2
    a = str.replace(" ", "").strip(",")
    b = a.split(",")
    c = b[1:-1]
    return " ".join(c) if str and l and a and b and c else None

def array(string):
  return " ".join(string.split(",")[1:-1]) or None

def array(s):
    return ' '.join(s.split(',')[1:-1]) or None

def array(string):
    split = string.split(",") 
    remove = split[1:-1]
    return " ".join(remove) if remove else None

def array(string):
    if len(string.split(","))>2:
        return(str(' '.join(string.split(',')[1:-1])))


def array(string):
    s = string.replace(" ", "").split(",")
    return ' '.join(s[1:-1]) if s[1:-1] != [] else None

def array(string):
    s = string.replace(" ", "").split(",")
    return " ".join(s[1:-1]) if len(s) > 2 else None

def array(string: str) -> str:
    """ Remove first and last character of the string. """
    array = string.split(",")
    if len(array) > 2:
        return " ".join(array[1:-1])

def array(string: str) -> str:
    array = string.split(",")
    if len(array) > 2:
        return " ".join(array[1:-1])

def array(string):
    newstring = string.strip().split(',')
    l =  newstring[1:-1]
    s = ' '.join(l)
    if len(s) == 0:
        print(None)
    else:
        return(s)


        



#     newstring = string.strip()
#     newstring = (newstring[1:-2].replace(',', ' ')).strip()
#     if len(newstring) == 0:
#         print(None)
#     else:    
#         return newstring


def array(string):
    string = string.split(",")
    print((len(string)))
    print(string)
    if len(string) <= 2:
        return None
    else: 
        string = string[1:-1]
        print(string)
        return " ".join(string)


def array(string):
    list1 = string.split(',')
    if len(list1) <= 2:
        return None
    else:
        return ' '.join(list1[1:-1])


def array(string):
    res = ' '.join(string.split(',')[1:-1])
    if not res:
        return None
    return res

def array(string):
    str_list = string.split(",")
    if len(str_list) < 3:
        return None

    str_list.pop(0)
    str_list.pop(len(str_list) - 1)

    return " ".join(str_list) if str_list != "" else None

def array(string):
    numbers = string.split(',')
    return None if len(numbers) < 3 else ' '.join(string.split(',')[1:-1])

def array(string):
    #print(string)
    str_slice = string.split(",")[1:-1]  #Split the string with , and get the list of all chars except first and last
    #print(str_slice)
    return ' '.join(str_slice) if str_slice else None  #if the string is not empty,
                                                      # return string else return None


def array(string):
    x = string.split(',')
    if len(x) <= 2 :
        return None
    else:
        x.pop()
        x.pop(0)
        return ' '.join(x)
print((array('1,2,3,4,5,6,7,8,9')))


def array(string):
    string = string.replace(" ", "")
    arr = string.split(",")
    return None if len(arr) < 3 else " ".join(arr[1:-1])

def array(string):
    list = string.split(",")[1:-1]
    if len(list) ==0: return None
    else: return " ".join(list)

def array(string):
    s = string.split(',')
    if len(s) >= 3:
        return ' '.join(s[1:-1])
    return

def array(string):
    array = string.split(',')[1:-1]
    new = ' '.join(array)
    return None if not new else new

def array(string):
    strlist = string.split(",")
    finalstr = ' '.join(strlist[1:-1]) 
    return finalstr if finalstr != "" else None

def array(string):
    string = string.replace(' ','')
    arr = string.split(',')
    if len(arr) <= 2:
        return None
    else: 
        return ' '.join(arr[1:-1])

def array(st):
    st = st.replace(" ","")
    arr = st.split(",")
    if len(arr) <= 2: return None
    return " ".join(arr[1:-1])

def array(string):
    lst = string.split(',')
    if len(lst) < 3: return None
    lst.pop(0)
    lst.pop(-1)
    return ' '.join(lst)


def array(string):
    result = ""
    x = string.split(',')
    if len(x) < 3:
        return None
    else:
        for i in range(1, len(x)-1):
            result += x[i] + " "
        return result[:-1]
    


def array(string):
    rez=string.split(",")
    if len(rez)<=2: 
        return None 
    s=""
    for x in range(1, len(rez)-1):
        s=s+rez[x]+" "
    return s[:-1]
    


def array(string):
    if len(string.split(',')) < 3:
        return
    return ' '.join(string.split(',')[1: -1])

import numpy as np

def array(string):
    a = string.split(',')
    if len(a) <= 2:
        return None
    else:
        return ' '.join(a[1:len(a)-1])

def array(string):
    first=-1
    last=-1
    for i in range(len(string)):
        if string[i]==',' and first==-1:
            first=i
        if string[len(string)-i-1]==',' and last==-1:
            last=i
    if -last-1+len(string)==first or first==-1 or last==-1:
        return None
    return string.replace(' ','').replace(',',' ')[first+1:-last-1]


def array(string):
    a = list(string.split(','))
    if len(a) <= 2:
        return None
    else:
        return ' '.join(a[1:-1])

import re


def array(string):
    string = list(re.split(',| ', string))
    num = []
    for s in string:
        if s != "":
            num.append(s)

    if len(num) < 3:
        return None

    else:
        return " ".join(num[1:-1])

import re
def array(string):
    l = re.sub( r' ', '', string ).split(',')
    if len(l) <= 2:
        return None
    else:
        return ' '.join( l[1:-1] )

def array(string):
    l = string.split(',')
    if len(l) < 3:
        return
    return ' '.join(x.strip() for x in l[1:-1])

def array(string):
    res = string.split(',')
    if len(res) < 3:
        return None
    res.pop()
    res.pop(0)
    
    return ' '.join(res)


def array(string):
    new_string = string.split(",")[1:-1]
    if len(new_string) == 0:
        return None
    else:
        return ' '.join(new_string)

def array(string):
    string = string.split(',')
    
    list = ' '.join(string[1:-1])
    
    if len(list) > 0:
        return list
    else:
        None

def array(string=''):
    strings = string.split(',')
    return None if len(strings) < 3 else ' '.join([strings[i] for i in range(1, len(strings)-1)])

def array(string):
    stripped_string_array = string.split(',')[1:-1]
    if len(stripped_string_array) == 0:
        return None

    return " ".join(stripped_string_array)


def array(string):
    elems = list(map(str.strip, string.split(',')))
    
    if len(elems) < 3:
        return None
    
    return ' '.join(elems[1:-1])


def array(string):
    #Had to add the replace() since some of the input test strings have spaces
    #in addition to commas
    
    #step1: Convert the input string to list of characters, removing spaces
    #and splitting based on comma
    l = string.replace(' ','').split(',')
    
    #step 2: return all the chars in list, except first and list, joined using ' '
    #check for len of list and return None if < 3
    return ' '.join(l[1:-1]) if len(l) >= 3 else None

def array(string):
    #your code here
    if string.count(',')>1:
        return " ".join(string.split(",")[1:-1]).strip()
    return None

def array(string):
    print(string)
    return ' '.join(string.split(',')[1:-1]) or None

def array(string):
    print(string)
    return ' '.join(string.split(',')[1:-1]) if len(string.split(',')) > 2 else None

def array(string):
    s1 = string.split(",")
    s2 = str(" ".join(s1[1:-1]))
    return s2 if s2 else None

def array(string):
    if string == "" or len(string) < 5:
        return None
    word = string.split(",")
    res = []
    for i in range(1, len(word)-1):
        res.append(word[i])
    if len(res)<1:
        return None
    else:
        return " ".join(res)
        
    #your code here


def array(string):
    #your code here
    if string == "" or len(string.split(",")) <= 2:
        return None
    else:
        string = string.split(",")
        string = string[1:-1]
        
        return " ".join(string)


def array(string):
    #your code here
    v = string.split(',')
    if len(v)>2:
        v.pop()
        v.pop(0)
        return ' '.join(v)
    else:
        return None

def array(string):
    res = ' '.join(string.split(',')[1:-1])
    return res if res else None

def array(string):
    length=len(string.replace(" ", "").replace(",", ""))
    if length >2:
        result= " ".join(string.split(",")[1:-1])
        if result != '':
            return result
        else:
            return None


def array(string):
    x = ' '.join(string.split(',')[1:-1])
    if x: return x

def array(string):
    string_list = string.split(',')
    return ' '.join(string_list[1:-1]) if string_list[1:-1] else None


def array(string):
    string = ' '.join(string.split(",")[1:-1])
    if string:
        return string.strip()
    else:
        return None


def array(s):
    if len(s.split(',')) < 3:
        return
    else:
        return ' '.join(s.split(',')[1:-1])

def array(string):
    k = ' '.join(string.split(',')[1:-1])
    if k: return k
    else: return None

def array(string):
    arr = string.replace(' ', '').split(',')
    if len(arr) > 2:
        s = ''
        for x in arr[1 : -1]:
            s = s + ' ' + x
        return s[1 :]
    else:
        None

def array(string):
    x = string.split(',')
    y = x[1:-1]
    return None if len(x) < 3 else ' '.join(y)

def array(string):
    if len(string.split(',')) > 2:
        a = string.split(',')[1:-1]
        k = ''
        for c in a:
            k = k + c + ' '
        return k[:-1]
    else:
        return None

def array(string):
    x = string.split(',')
    r = None
    if len(x) > 2:
        r = ' '.join(x[1:-1])
    return r

def array(string):
    new= string.split(',')
    if string == "" or len(new)<=2:
        return None 
    else: 
        new = new[1:len(new)-1]
        new_str=' '.join(new)
        return new_str


def array(string):
    return ' '.join(list(string.split(','))[1:-1]) if len(list(string.split(',')))>2 else None

def array(s):
    arr = s.split(",")[1:-1]
    if arr == []:
        return None
    return " ".join(arr)

def array(string):
    length=len(string)
    answer=""
    if length==0 or length==1 or length==3:
        answer=None
    else:
        x=0
        comma=[]
         
        while x<length:
            if string[x]==",":
                comma.append(x)
            x=x+1
        if len(comma)>0:
            start=comma[0]
            stop=comma[-1]
            answer=string[start:stop+1]
            
        answer=answer.replace(',', ' ')
        answer=answer [1:-1]
        if answer=="":
            answer=None
    return answer

def array(p):
    print(p)
    astring = ""
    s = (p.replace(" ", "")).split(",")
    print(s)
    if len(s) < 3:
        return None
    for i in range(0, len(s)-1):
        if i == 0:
            pass
        else:
            astring += s[i] + " "
    ansr = astring.rstrip()
    return ansr
        


def array(string):
    a = string.split(',')
    if len(a) > 2:
        return ' '.join(a[1:-1])
    else:
        return None

def array(string):
    x = string.split(',')
    if len(x) < 3: return None
    return " ".join(x[1:-1])

def array(string):
    x = string.replace(" ", "").split(",")
    if len(x) < 3:
        return None
    return " ".join(x[1:-1])


def array(string):
    mod = string.replace(',', ' ').split()
    if len(mod) < 3:
        return None
    return ' '.join(mod[1:-1])

def array(s):
    arr = s.replace(" ", "").split(",")
    return None if len(arr) <= 2 else " ".join(arr[1:-1])

def array(s):
    s=s.replace(",", " ")
    s=s.split()
    if len(s) < 3: return None
    
    return " ".join(s[1:-1])

def array(string):
    strings = string.split(',')
    del strings[0]
    if len(strings) > 0:
        del strings[len(strings)-1]
    result = ''
    for i in strings:
        result = result + str(i) + ' '
    if len(result) > 0:
        return result.strip()
    else:
        return None

def array(string):
    splitted = []
    if string == '':
        return None
    else: 
        splitted = string.split(",")
        if len(splitted) < 3:
            return None
        else: 
            splitted = splitted[1:]
            splitted = splitted[:-1]
            result = ''
            i = 1
            for x in splitted:
                result = result + x
                if i != len(splitted):
                    result = result + " "
                i = i + 1
            return result

def array(string):
    string = string.replace(" ","")
    array = string.split(",")
    array = array[1:-1]
    return " ".join(array, ) if len(array) > 0 else None
#string[2:-2] if len(string) > 4 else None


def array(string):
    # convert string in list
    string_to_list = string.split(",")
    # remove first and last item
    remove_item = string_to_list[1:-1]
    # convert list in string
    result = " ".join(remove_item)
    # control string is not only spaces
    if result.isspace() is True or result == '':
        return None
    else:
        return result

def array(string):
    if len(string) <= 4 or len(" ".join(string.split(",")[1:-1])) == 0 :
        return None
    else:
        return " ".join(string.split(",")[1:-1])

def array(string):
    s = string.split(",")
    return None if len(s) < 3 else " ".join(x for x in s[1: -1])

def array(string):
    print(string)
    if len(string.split(',')) <= 2:
        return None
    else:
        listed = string.split(',')
        print((listed[1:][:-1]))
        listed = listed[1:][:-1]
        return ' '.join(listed)
    


def array(string):
    l = string.split(',')
    return None if not len(l) >= 3 else ' '.join(l[1:-1])


def array(s):
    if s=='':
        return None
    else:
        a=s.replace(' ','').replace(',',' ').split(' ')
        return None if len(a)<=2 else ' '.join(a[1:len(a)-1])

def array(string):
    r = ' '.join(string.split(',')[1:-1]) 
    return r if len(r)>0 else None
    


def array(string):
    items = string.split(",")[1:-1]
    return " ".join(items) if len(items)>0 else None


def array(string):
    
    s = string.split(',')
    s2 = ' '.join(s[1:len(s)-1])
    return s2 if s2 is not '' else None

def array(string):
    print(string)
    if string.count(",") < 2: return None
    string = string.replace(",", " ")
    
    front = 0
    for letter in string:
        front += 1
        if letter == " ": break
    back = 0
    for letter in reversed(string):
        back += 1
        if letter == " ": break
            
    return string[front:-back]
            
            
        


def array(string):
    return " ".join(string.split(",")[1:-1]) if string and len(string.split(",")[1:-1]) > 0 else None

def array(string):
    string = string.split(',')
    if len(string) <= 2:
        return None
    else:
        string.pop(0)
        string.pop(len(string) - 1)
    return ' '.join(string)
        


def array(string: str) -> str:
    return (
        None if len(string.split(",")[1:-1]) == 0 else " ".join(string.split(",")[1:-1])
    )



def array(string):
    x = string.replace(' ', '').split(',')
    return ' '.join(x[1 : -1]) if len(x) > 2 else None

def array(s):
    s = (s.replace(' ', '').replace(',', ' ')).split(' ')
    return ' '.join(s[1:len(s) - 1]) if len(s) > 2 else None

def array(string):
    result = string.replace(',', ' ').split()
    return None if len(result) < 3 else ' '.join(result[1:-1])

def array(s):
    m = s.split(",")
    if len(m)<=2: return None
    return " ".join(m[1:-1])


def array(string):
    #your code here
    new_string = string.split(',')
    results = ''

    for i  in range(len(new_string)):
        if i != 0 and i != len(new_string)-1: 
            results += new_string[i] + ' '
    if not len(results): 
        return None
    
    return results[0:-1]          


def array(s):
    a = " ".join(s.split(",")[1:-1])
    return a if a else None

def array(string):
    liste=string.split(',')
    if len(liste)>2:
        liste.pop()
        return ' '.join(liste[1:])


def array(s):
    a = s.split(',')
    if len(a)>2:
        return ' '.join(a[1:-1])

def array(string):
    m = string.split(',')
    if len(m)>2: 
        return ' '.join(m[1:-1])
    else: 
        return None

import re

def array(string):
    arr = re.split(',\s*', string)
    if len(arr) < 3:
        return None
    return ' '.join(arr[1:-1])