S = eval(input())

y = 0

sum_t = 0

up = False

pre = y

for i in range(len(S)):

	if S[i] == '<':

		if up & (i!=(len(S))):

			y += 1

			sum_t += y

		else:

			y = 1

			sum_t += y

		up = True

	elif S[i] == '>':

		if up == False & (i!=(len(S))):

			y += 1

			sum_t += y

			if y <= pre:

				sum_t -=1

		else:

			pre = y

			y = 1

		up = False

print(sum_t)
S = eval(input())

y = 0

sum_t = 0

up = False

pre = y

for c in S:

	if c == '<':

		if up:

			y += 1

		else:

			y = 1

		sum_t += y

		up = True

	elif c == '>':

		if up:

			pre = y

			y = 1

		else:

			y += 1

			sum_t += y

			if y <= pre:

				sum_t -=1

		up = False

print(sum_t)
S = eval(input())
y = 0
sum_t = 0
up = False
pre = y
for i in range(len(S)):
    if S[i] == "<":
        if up & (i != (len(S))):
            y += 1
            sum_t += y
        else:
            y = 1
            sum_t += y
        up = True
    elif S[i] == ">":
        if up == False & (i != (len(S))):
            y += 1
            sum_t += y
            if y <= pre:
                sum_t -= 1
        else:
            pre = y
            y = 1
        up = False
print(sum_t)

S = eval(input())
y = 0
sum_t = 0
up = False
pre = y
for c in S:
    if c == "<":
        if up:
            y += 1
        else:
            y = 1
        sum_t += y
        up = True
    elif c == ">":
        if up:
            pre = y
            y = 1
        else:
            y += 1
            sum_t += y
            if y <= pre:
                sum_t -= 1
        up = False
print(sum_t)

-for i in range(len(S)): -    if S[i] == "<": -        if up & (i != (len(S))): +for c in S: +    if c == "<": +        if up: -            sum_t += y -            sum_t += y +        sum_t += y -    elif S[i] == ">": -        if up == False & (i != (len(S))): +    elif c == ">": +        if up: +            pre = y +            y = 1 +        else: -        else: -            pre = y -            y = 1