Buggy python submission (verdict: Runtime Error):
s = input()

a = []
index = 0
diff = 0
for i in range(len(s) - 1):
    if s[i] == "<":
        a.appned(a[-1] + 1)
        index += 1

    else:
        if s[i + 1] == "<":
            diff = index - i

            if a[-1] <= diff:
                a[-1] = diff

            a = a + [diff - 1 - i for i in range(diff)]
            index += count
            count = 0
        else:
            count += 1

if count != 0:
    diff = index - len(s) + 1
    if a[-1] <= diff:
        a[-1] = diff

    a = a + [diff - 1 - i for i in range(diff)]

print(sum(a))


Fixed submission:
s = input()

index = 0
thanS = s[0]
count = 1
a = []
for i in range(1, len(s)):
    if thanS == s[i]:
        count += 1

    else:
        a.append(s[index: index + count])
        thanS = s[i]
        index = index + count
        count = 1

a.append(s[index:])
b = 0
add = 0

for i in range(len(a)):
    diff = len(a[i])
    if a[i][0] == "<":
        add += diff * (diff + 1) / 2
        b = diff
    else:
        if b < diff:
            add = add + diff * (diff + 1) / 2 - b
        else:
            add = add + (diff - 1) * diff / 2
        b = 0

print(int(add))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

index = 0
thanS = s[0]
count = 1
a = []
for i in range(1, len(s)):
    if thanS == s[i]:
        count += 1

    else:
        a.append(s[index: index + count])
        thanS = s[i]
        index = index + count
        count = 1

a.append(s[index:])
b = [0]

for i in range(len(a)):
    diff = len(a[i])
    if a[i][0] == "<":
        add = [b[-1] + 1 + j for j in range(diff)]
    else:
        if b[-1] < diff:
            b[-1] = diff
        add = [diff - j for j in range(1, diff + 1)]
    b = b + add

print(sum(b))


Fixed submission:
s = input()

index = 0
thanS = s[0]
count = 1
a = []
for i in range(1, len(s)):
    if thanS == s[i]:
        count += 1

    else:
        a.append(s[index: index + count])
        thanS = s[i]
        index = index + count
        count = 1

a.append(s[index:])
b = 0
add = 0

for i in range(len(a)):
    diff = len(a[i])
    if a[i][0] == "<":
        add += diff * (diff + 1) / 2
        b = diff
    else:
        if b < diff:
            add = add + diff * (diff + 1) / 2 - b
        else:
            add = add + (diff - 1) * diff / 2
        b = 0

print(int(add))

Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())

index = 0
thanS = s[0]
count = 1
a = []
for i in range(1, len(s)):
    if thanS == s[i]:
        count += 1

    else:
        a.extend([s[index: index + count]])
        thanS = s[i]
        index = index + count
        count = 1

a.extend([s[index:]])
b = [0]

for i in range(len(a)):
    diff = len(a[i])
    if a[i][0] == "<":
        add = [b[-1] + 1 + j for j in range(diff)]
    else:
        if b[-1] <= diff:
            b[-1] = diff
        add = [diff - j for j in range(1, diff + 1)]
    b = b + add

print(sum(b))


Fixed submission:
s = input()

index = 0
thanS = s[0]
count = 1
a = []
for i in range(1, len(s)):
    if thanS == s[i]:
        count += 1

    else:
        a.append(s[index: index + count])
        thanS = s[i]
        index = index + count
        count = 1

a.append(s[index:])
b = 0
add = 0

for i in range(len(a)):
    diff = len(a[i])
    if a[i][0] == "<":
        add += diff * (diff + 1) / 2
        b = diff
    else:
        if b < diff:
            add = add + diff * (diff + 1) / 2 - b
        else:
            add = add + (diff - 1) * diff / 2
        b = 0

print(int(add))

Buggy python submission (verdict: Time Limit Exceeded):
import copy

s = list(input())
s2 = copy.deepcopy(s)

thanS = s[0]
count = 1
a = []
for i in range(1, len(s)):
    if thanS == s[i]:
        count += 1

    else:
        thanS = s[i]
        if count == 1:
            a.append(s2[0: 1])
            del s2[0: 1]
        else:
            a.append(s2[0: count])
            del s2[0:count]
        count = 1

a.append(s2)
del s2
b = [0]

for i in range(len(a)):
    c = a[i]

    if c[0] == "<":
        add = [b[-1] + 1 + j for j in range(len(c))]
        b = b + add
    else:
        diff = len(c)
        if b[-1] <= diff:
            b[-1] = diff
            b = b + [diff - j for j in range(1, diff + 1)]
        else:
            b = b + [diff - j for j in range(1, diff + 1)]

print(sum(b))


Fixed submission:
s = input()

index = 0
thanS = s[0]
count = 1
a = []
for i in range(1, len(s)):
    if thanS == s[i]:
        count += 1

    else:
        a.append(s[index: index + count])
        thanS = s[i]
        index = index + count
        count = 1

a.append(s[index:])
b = 0
add = 0

for i in range(len(a)):
    diff = len(a[i])
    if a[i][0] == "<":
        add += diff * (diff + 1) / 2
        b = diff
    else:
        if b < diff:
            add = add + diff * (diff + 1) / 2 - b
        else:
            add = add + (diff - 1) * diff / 2
        b = 0

print(int(add))