title = ['Name', 'Address', 'Description']
input = [['Reddit', 'www.reddit.com', 'the frontpage of the internet'],['Wikipedia', 'en.wikipedia.net', 'The Free Encyclopedia'],['xkcd', 'xkcd.com', 'Sudo make me a sandwich.']]

def maxWidth(title, input, i):
    maxwidth = len(title)
    for j in input:
        maxwidth = max(maxwidth, len(j[i]))
    return (maxwidth + 2)

def borderString(title, input):
    string = ""
    for i in range(0, len(title)):
        width = maxWidth(title[i], input, i)
        string = string + "+" + ("-" * width)
    string = string + "+"
    return string
def titleString(title, input):
       for i in range(0, len(title)):
        width = maxWidth(title[i], input, i)
        widthleft = (width - len(title[i]))//2
        widthright = (width - len(title[i]))//2 + (width - len(title[i])) % 2
        print("|"," " * widthleft, title[i], " " * widthright, sep="", end="")
       print("|")
def itemString(title, input, i):
       for j in range(0, len(title)):
        width = maxWidth(title[j], input, j)
        widthright = width - len(input[i][j]) - 1
        print("| ", input[i][j], " " * widthright, sep = "", end="")
       print("|")
def main():
    string = borderString(title,input)
    print(string)
    titleString(title, input)
    print(string)
    for i in range(0, len(input)):
        itemString(title, input, i)
    print(string)

main()