consonants = 'bdfhjklmnprstvwzðŋɡʃʒθ'
vowels = 'aeiouæɑʊɔɪɛʌəᵻː'
stress_marks = 'ˈˌ'
def abugidafy(word):
# Dict from (x, y) to characters.
tiles = dict()
x = y = 0
is_first = True
for c in word:
if c in stress_marks:
tiles[x + 1, 1] = c
elif c in consonants or is_first:
y = 0
x += 1
tiles[x, y] = c
is_first = False
elif c in vowels:
y -= 1
tiles[x, y] = c
is_first = False
else:
raise ValueError('Not an IPA character: ' + c)
xs = [x for (x, y) in tiles.keys()]
ys = [y for (x, y) in tiles.keys()]
xmin, xmax = min(xs), max(xs)
ymin, ymax = min(ys), max(ys)
lines = []
for y in range(ymin, ymax + 1):
line = [tiles.get((x, y), ' ') for x in range(xmin, xmax + 1)]
lines.append(''.join(line))
return '\n'.join(lines)
print(abugidafy(input()))
Y29uc29uYW50cyA9ICdiZGZoamtsbW5wcnN0dnd6w7DFi8mhyoPKks64Jwp2b3dlbHMgPSAnYWVpb3XDpsmRyorJlMmqyZvKjMmZ4bW7y5AnCnN0cmVzc19tYXJrcyA9ICfLiMuMJwoKZGVmIGFidWdpZGFmeSh3b3JkKToKICAgICMgRGljdCBmcm9tICh4LCB5KSB0byBjaGFyYWN0ZXJzLgogICAgdGlsZXMgPSBkaWN0KCkKICAgIHggPSB5ID0gMAoKICAgIGlzX2ZpcnN0ID0gVHJ1ZQogICAgZm9yIGMgaW4gd29yZDoKICAgICAgICBpZiBjIGluIHN0cmVzc19tYXJrczoKICAgICAgICAgICAgdGlsZXNbeCArIDEsIDFdID0gYwogICAgICAgIGVsaWYgYyBpbiBjb25zb25hbnRzIG9yIGlzX2ZpcnN0OgogICAgICAgICAgICB5ID0gMAogICAgICAgICAgICB4ICs9IDEKICAgICAgICAgICAgdGlsZXNbeCwgeV0gPSBjCiAgICAgICAgICAgIGlzX2ZpcnN0ID0gRmFsc2UKICAgICAgICBlbGlmIGMgaW4gdm93ZWxzOgogICAgICAgICAgICB5IC09IDEKICAgICAgICAgICAgdGlsZXNbeCwgeV0gPSBjCiAgICAgICAgICAgIGlzX2ZpcnN0ID0gRmFsc2UKICAgICAgICBlbHNlOgogICAgICAgICAgICByYWlzZSBWYWx1ZUVycm9yKCdOb3QgYW4gSVBBIGNoYXJhY3RlcjogJyArIGMpCgogICAgeHMgPSBbeCBmb3IgKHgsIHkpIGluIHRpbGVzLmtleXMoKV0KICAgIHlzID0gW3kgZm9yICh4LCB5KSBpbiB0aWxlcy5rZXlzKCldCiAgICB4bWluLCB4bWF4ID0gbWluKHhzKSwgbWF4KHhzKQogICAgeW1pbiwgeW1heCA9IG1pbih5cyksIG1heCh5cykKCiAgICBsaW5lcyA9IFtdCiAgICBmb3IgeSBpbiByYW5nZSh5bWluLCB5bWF4ICsgMSk6CiAgICAgICAgbGluZSA9IFt0aWxlcy5nZXQoKHgsIHkpLCAnICcpIGZvciB4IGluIHJhbmdlKHhtaW4sIHhtYXggKyAxKV0KICAgICAgICBsaW5lcy5hcHBlbmQoJycuam9pbihsaW5lKSkKICAgIHJldHVybiAnXG4nLmpvaW4obGluZXMpCgpwcmludChhYnVnaWRhZnkoaW5wdXQoKSkp