Description

In English we often use "neutral vowel sounds" such as "umm", "err", "ahh" as fillers in conversations to help them run smoothly.

Bob always finds himself saying "err". Infact he adds an "err" to every single word he says that ends in a consonant! Because Bob is odd, he likes to stick to this habit even when emailing. 

Task

Bob is begging you to write a function that adds "err" to the end of every word whose last letter is a consonant (not a vowel, y counts as a consonant). 

The input is a string that can contain upper and lowercase characters, some punctuation but no numbers. The solution should be returned as a string.

NOTE: If the word ends with an uppercase consonant, the following "err" will be uppercase --> "ERR".

eg:
```
"Hello, I am Mr Bob" --> "Hello, I amerr Mrerr Boberr"

"THIS IS CRAZY!"  --> "THISERR ISERR CRAZYERR!"
```


Good luck!

Difficulty: introductory

Starter code:

def err_bob(s):
	

Solutions:
def err_bob(s):
    res = ""
    for i, c in enumerate(s):
        res += c
        if i == len(s)-1 or s[i+1] in " .,:;!?":
            if c.islower() and c not in "aeiou":
                res += "err"
            if c.isupper() and c not in "AEIOU":
                res += "ERR"
    return res

import re

def err_bob(string):
    return re.sub(r'(?:[bcdfghjklmnpqrstvwxyz])\b',lambda m:m.group(0)+'ERR' if m.group(0).isupper() else m.group(0)+'err',string,flags=re.I)

import re

def err_bob(s):
    return re.sub(
        r'[bcdfghjklmnpqrstvwxyz]\b',
        lambda m: m.group() + ('err' if m.group().islower() else 'ERR'),
        s,
        flags=re.IGNORECASE
    )

import re
def err_bob(string):
    string = re.sub(r'([b-df-hj-np-tv-z])\b', r'\1err', string)
    string = re.sub(r'([B-DF-HJ-NP-TV-Z])\b', r'\1ERR', string)
    return string

import re

def err_bob(stg):
    return re.sub(r"[bcdfghj-np-tv-z]\b", end_err, stg, flags=re.I)

def end_err(char):
    return f"{char[0]}{'err' if char[0].islower() else 'ERR'}"


consonants = "bcdfghjklmnpqrstvwxyz"

def err_bob(stg):
    result = ""
    for i, char in enumerate(stg):
        result = f"{result}{char}"
        if char.isalpha() and not stg[i+1:i+2].isalpha():
            end = "err" if char in consonants else "ERR" if char in consonants.upper() else ""
            result = f"{result}{end}"
    return result

import re

def repl(m):
    return m[0]+('err' if m[0].islower() else 'ERR')

def err_bob(s):
    return re.sub(r'(?![aeiou])[a-z]\b', repl, s, flags=re.I)

def err_bob(s):
    t, a = "", "aeioubcdfghjklmnpqrstvwxyz"
    for i, c in enumerate(s + " "):
        if c.lower() not in a and s[i - 1].lower() in a[5:]:
            t += "ERR" if s[i - 1].isupper() else "err"
        t += c
    return t[:-1]

from re import sub

def err_bob(string):
    
    string = sub(r'\b(\w*[bcdfghjklmnpqrstvwxyz])\b', r'\1err', string)
    return sub(r'\b(\w*[BCDFGHJKLMNPQRSTVWXYZ])\b', r'\1ERR', string)