#!/usr/bin/python
import sys
x = 0; l = 1
print('{| border="1" class="wikitable"')
for line in sys.stdin.readlines():
type = "|"
if (x == 0):
type = "!"
if (x != 0):
print('|-')
if ("," in line):
l = 0
for coli in line.split(","):
print(type + ' style="white-space:nowrap;" | ' + coli.strip())
l += 1
else:
print('| colspan="'+str(l)+'" align="middle" | ' + line)
x += 1
print('|}')