• troubles with "b " and " c "

Question related to mission What Does the Cow Say?

 
import textwrap
import re

def cowsay(string, length=39):
    print  (string)

    return build_bubble(re.sub('\s{3,}',' ',string), length) + build_cow()
    #return " ".join(string.split())

def build_cow():
    return r'''
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
'''

def build_bubble(string, length=39):
    bubble = []

    lines = normalize_text(string, length)

    bordersize = len(lines[0])
    bubble.append("")
    bubble.append(" " + "_" * (bordersize+2))

    for index, line in enumerate(lines):
        border = get_border(lines, index)
        print (line)

        bubble.append("%s %s %s" % (border[0], line, border[1]))



    bubble.append(" " + "-" * (bordersize+2))

    return "\n".join(bubble)

def normalize_text(string, length):
    lines  = textwrap.wrap(string, length)
    maxlen = len(max(lines, key=len))
    return [ line.ljust(maxlen) for line in lines ]

def get_border(lines, index):
    if len(lines) < 2:
        return [ "<", ">" ]

    elif index == 0:
        return [ "/", "\\" ]

    elif index == len(lines) - 1:
        return [ "\\", "/" ]

    else:
        return [ "|", "|" ]