Kontti language is a finnish word play game.

You add `-kontti` to the end of each word and then swap their characters until and including the first vowel ("aeiouy"); 

For example the word `tame` becomes `kome-tantti`; `fruity` becomes `koity-fruntti` and so on.

If no vowel is present, the word stays the same.

Write a string method that turns a sentence into kontti language!

Difficulty: introductory

Starter code:

def kontti(s):
	

Solutions:
import re

def kontti(s):
    return  " ".join( [ re.sub("([^aeiouy]*[aeiouy])(.*)", r"ko\2-\1ntti", w, flags = re.I) for w in s.split() ] )

from re import sub
from functools import partial
kontti = partial(sub, r'(?i)(\S*?[aeiouy])(\S*)', r'ko\2-\1ntti')

import re

def kontti(s):
    return re.sub(r'(\S*?[aeiouy])(\S*)', r'ko\2-\1ntti', s, flags=re.I)

def kontti(stg):
    return " ".join(k_w(word) for word in stg.split())
    
def k_w(stg):
    i = next((i for i, c in enumerate(stg.lower()) if c in "aeiouy"), -1)
    return f"ko{stg[i+1:]}-{stg[:i+1]}ntti" if i > -1 else stg

import re
    
def kontti(s):
    return re.sub(r'\b([^aeiouy\s]*[aeiouy])(\S*)', r'ko\2-\1ntti', s, flags=re.I)

kontti=lambda w: " ".join([(lambda pos: "".join(["ko",s[pos+1:],"-",s[:pos+1],"ntti"]))([i for i,l in enumerate(s) if l.lower() in "aeiouy"][0]) if any(l.lower() in "aeiouy" for l in s) else s for s in w.split(" ")]) if len(w) else ""

kontti=lambda s:' '.join((lambda i:i<len(w)and'ko'+w[i+1:]+'-'+w[:i+1]+'ntti'or w)(min(i for i,c in enumerate(w+'a')if c in'aeiouyAEIOUY'))for w in s.split())

def kontti(s):
    result = []
    for w in s.split():
        i = next((i for i,c in enumerate(w, 1) if c in "aeiouyAEIOUY"), None)
        result.append(w if i is None else f"ko{w[i:]}-{w[:i]}ntti")
    return ' '.join(result)

def kontti(st):
    r = []
    for s in st.split():
        a,s = '',list(s)
        if not any(i in s for i in 'aeiouyAEIOUY'):
            r.append(''.join(s))
        else:
            while s:
                a += s.pop(0)
                if a[-1] in 'aeiouyAEIOUY':
                    break
            r.append(f"ko{''.join(s)}-{a}ntti")
    return ' '.join(r)

from re import search
def kontti(s):
    words=[]
    
    for word in s.split():
        i=search("[aeiouyAEIOUY]",word)
        if i:
            i=i.start()
            words.append(f"ko{word[i+1:]}-{word[:i+1]}ntti")
        else:words.append(word)
    return " ".join(words)