Buggy python submission (verdict: Runtime Error):
import sys
from operator import itemgetter
input = sys.stdin.readline

_s = input()


def chker(s):
    l, r, minisum = 0, 0, 0
    if s[0] == '<':
        l += 1
    elif s[i] == '>':
        r += 1
    for i in range(1, len(s)):
        if s[i - 1] == '>' and s[i] == '<':
            l, r = (l, r) if l > r else (r, l)
            minisum += l * (l + 1) / 2 + r * (r - 1) / 2
            l, r = 1, 0
        else:
            if s[i] == '<':
                l += 1
            elif s[i] == '>':
                r += 1

    l, r = (l, r) if l > r else (r, l)
    minisum += l * (l + 1) / 2 + r * (r - 1) / 2

    print(int(minisum))


chker(_s)


Fixed submission:
import sys
from operator import itemgetter
input = sys.stdin.readline

_s = input()


def chker(s):
    l, r, minisum = 0, 0, 0
    if s[0] == '<':
        l += 1
    elif s[0] == '>':
        r += 1
    for i in range(1, len(s)):
        if s[i - 1] == '>' and s[i] == '<':
            l, r = (l, r) if l > r else (r, l)
            minisum += l * (l + 1) / 2 + r * (r - 1) / 2
            l, r = 1, 0
        else:
            if s[i] == '<':
                l += 1
            elif s[i] == '>':
                r += 1

    l, r = (l, r) if l > r else (r, l)
    minisum += l * (l + 1) / 2 + r * (r - 1) / 2

    print(int(minisum))


chker(_s)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from operator import itemgetter
input = sys.stdin.readline

_s = input()


def chker(s):
    slist = []
    i = 1
    while len(s) >= i:
        if s[i - 1:i + 1] == '><':
            slist.append(s[:i])
            s = s[i:]
            i = 1
        else:
            i += 1

    slist.append(s)

    minisum = 0
    for item in slist:
        l, r = item.count('<'), item.count('>')
        l, r = (l, r) if l > r else (r, l)
        minisum += l * (l + 1) / 2 + r * (r - 1) / 2

    print(int(minisum))


chker(_s)


Fixed submission:
import sys
from operator import itemgetter
input = sys.stdin.readline

_s = input()


def chker(s):
    l, r, minisum = 0, 0, 0
    if s[0] == '<':
        l += 1
    elif s[0] == '>':
        r += 1
    for i in range(1, len(s)):
        if s[i - 1] == '>' and s[i] == '<':
            l, r = (l, r) if l > r else (r, l)
            minisum += l * (l + 1) / 2 + r * (r - 1) / 2
            l, r = 1, 0
        else:
            if s[i] == '<':
                l += 1
            elif s[i] == '>':
                r += 1

    l, r = (l, r) if l > r else (r, l)
    minisum += l * (l + 1) / 2 + r * (r - 1) / 2

    print(int(minisum))


chker(_s)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from operator import itemgetter
input = sys.stdin.readline

_s = input()


def chker(s):
    slist = []
    i = 1
    while len(s) >= i:
        if s[i - 1:i + 1] == '><':
            slist.append(s[:i])
            s = s[i:]
            i = 1
        else:
            i += 1

    slist.append(s)

    minisum = 0
    for item in slist:
        l, r = item.count('<'), item.count('>')
        l, r = (l, r) if l > r else (r, l)
        minisum += sum([num for num in range(l + 1)]) + sum([num for num in range(r)])

    print(minisum)


chker(_s)


Fixed submission:
import sys
from operator import itemgetter
input = sys.stdin.readline

_s = input()


def chker(s):
    l, r, minisum = 0, 0, 0
    if s[0] == '<':
        l += 1
    elif s[0] == '>':
        r += 1
    for i in range(1, len(s)):
        if s[i - 1] == '>' and s[i] == '<':
            l, r = (l, r) if l > r else (r, l)
            minisum += l * (l + 1) / 2 + r * (r - 1) / 2
            l, r = 1, 0
        else:
            if s[i] == '<':
                l += 1
            elif s[i] == '>':
                r += 1

    l, r = (l, r) if l > r else (r, l)
    minisum += l * (l + 1) / 2 + r * (r - 1) / 2

    print(int(minisum))


chker(_s)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from operator import itemgetter
input = sys.stdin.readline

_s = input()


def chker(s):
    slist = []
    i = 1
    while len(s) >= i:
        if s[i - 1:i + 1] == '><':
            slist.append(s[:i])
            s = s[i:]
            i = 1
        else:
            i += 1

    slist.append(s)

    minisum = 0
    for item in slist:
        l, r = item.count('<'), item.count('>')
        l, r = (l, r) if l > r else (r, l)
        minisum += sum([num for num in range(l + 1)]) + sum([num for num in range(r)])

    print(minisum)


chker(_s)


Fixed submission:
import sys
from operator import itemgetter
input = sys.stdin.readline

_s = input()


def chker(s):
    l, r, minisum = 0, 0, 0
    if s[0] == '<':
        l += 1
    elif s[0] == '>':
        r += 1
    for i in range(1, len(s)):
        if s[i - 1] == '>' and s[i] == '<':
            l, r = (l, r) if l > r else (r, l)
            minisum += l * (l + 1) / 2 + r * (r - 1) / 2
            l, r = 1, 0
        else:
            if s[i] == '<':
                l += 1
            elif s[i] == '>':
                r += 1

    l, r = (l, r) if l > r else (r, l)
    minisum += l * (l + 1) / 2 + r * (r - 1) / 2

    print(int(minisum))


chker(_s)