from collections import deque

dq = deque([])  # for tags
stack = []  # for words
word = input()
ans = ''

tag = False

for c in word:
    if not tag:
        if c=='<':  # start of tag
            size = len(stack)  # empty stack
            for _ in range(size):
                ans += stack.pop()

            tag = True
            dq.append(c)  # add to deque
        elif c==' ':  # end of word
            size = len(stack)  # empty stack
            for _ in range(size):
                ans += stack.pop()
            ans += ' '
        else:  # middle of word
            stack.append(c)

    else:
        if c=='>':  #  end of tag
            tag = False
            size = len(dq)  # empty deque
            for _ in range(size):
                ans += dq.popleft()
            ans += '>'
        else:  # middle of tag
            dq.append(c)

if len(stack)!=0:  # empty remaining stack
    size = len(stack)
    for _ in range(size):
        ans += stack.pop()
print(ans)
6d6a35c62b253b5a3b756f41f1337e93d59fcab4
<mask token>

<mask token>
for c in word:
    if not tag:
        if c == '<':
            size = len(stack)
            for _ in range(size):
                ans += stack.pop()
            tag = True
            dq.append(c)
        elif c == ' ':
            size = len(stack)
            for _ in range(size):
                ans += stack.pop()
            ans += ' '
        else:
            stack.append(c)
    elif c == '>':
        tag = False
        size = len(dq)
        for _ in range(size):
            ans += dq.popleft()
        ans += '>'
    else:
        dq.append(c)
if len(stack) != 0:
    size = len(stack)
    for _ in range(size):
        ans += stack.pop()
print(ans)

<mask token>
dq = deque([])
stack = []
word = input()
ans = ''
tag = False
for c in word:
    if not tag:
        if c == '<':
            size = len(stack)
            for _ in range(size):
                ans += stack.pop()
            tag = True
            dq.append(c)
        elif c == ' ':
            size = len(stack)
            for _ in range(size):
                ans += stack.pop()
            ans += ' '
        else:
            stack.append(c)
    elif c == '>':
        tag = False
        size = len(dq)
        for _ in range(size):
            ans += dq.popleft()
        ans += '>'
    else:
        dq.append(c)
if len(stack) != 0:
    size = len(stack)
    for _ in range(size):
        ans += stack.pop()
print(ans)

from collections import deque
dq = deque([])
stack = []
word = input()
ans = ''
tag = False
for c in word:
    if not tag:
        if c == '<':
            size = len(stack)
            for _ in range(size):
                ans += stack.pop()
            tag = True
            dq.append(c)
        elif c == ' ':
            size = len(stack)
            for _ in range(size):
                ans += stack.pop()
            ans += ' '
        else:
            stack.append(c)
    elif c == '>':
        tag = False
        size = len(dq)
        for _ in range(size):
            ans += dq.popleft()
        ans += '>'
    else:
        dq.append(c)
if len(stack) != 0:
    size = len(stack)
    for _ in range(size):
        ans += stack.pop()
print(ans)

from collections import deque

dq = deque([])  # for tags
stack = []  # for words
word = input()
ans = ''

tag = False

for c in word:
    if not tag:
        if c=='<':  # start of tag
            size = len(stack)  # empty stack
            for _ in range(size):
                ans += stack.pop()

            tag = True
            dq.append(c)  # add to deque
        elif c==' ':  # end of word
            size = len(stack)  # empty stack
            for _ in range(size):
                ans += stack.pop()
            ans += ' '
        else:  # middle of word
            stack.append(c)

    else:
        if c=='>':  #  end of tag
            tag = False
            size = len(dq)  # empty deque
            for _ in range(size):
                ans += dq.popleft()
            ans += '>'
        else:  # middle of tag
            dq.append(c)

if len(stack)!=0:  # empty remaining stack
    size = len(stack)
    for _ in range(size):
        ans += stack.pop()
print(ans)