Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth release of the product.

You are to implement the alignment in the shortest possible time. Good luck!
The input file consists of one or more lines, each of the lines contains Latin letters, digits and/or spaces. The lines cannot start or end with a space. It is guaranteed that at least one of the lines has positive length. The length of each line and the total amount of the lines do not exceed 1000.
'''
Jana Goodman

5A chat server

This  is

Codeforces
Beta
Round
5

for odds, alternate starting left
  closer to left / right / ...
'''
import sys

LEFT = 0
RIGHT = 1
SPACE = '.'
STAR = '*'

if __name__ == '__main__':
    lines = [line.strip() for line in sys.stdin]
    left_or_right = LEFT
    width = max(len(line) for line in lines)
    print(STAR * (width + 2))
    for line in lines:
        fill_len = width - len(line)
        if fill_len % 2 == 0:
            spaces = SPACE * (fill_len // 2)
            print(f'{STAR}{spaces}{line}{spaces}{STAR}')
        else:
            sp_len = fill_len // 2
            if left_or_right == LEFT:
                spaces1, spaces2 = SPACE * sp_len, SPACE * (sp_len + 1)
                left_or_right = RIGHT
            else:
                spaces1, spaces2 = SPACE * (sp_len + 1), SPACE * sp_len
                left_or_right = LEFT
            print(f'{STAR}{spaces1}{line}{spaces2}{STAR}')
    print(STAR * (width + 2))
