In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at position i it goes one position to the right (to the position i + 1) if the type of this bumper is '>', or one position to the left (to i - 1) if the type of the bumper at position i is '<'. If there is no such position, in other words if i - 1 < 1 or i + 1 > n, the ball falls from the game field.

Depending on the ball's starting position, the ball may eventually fall from the game field or it may stay there forever. You are given a string representing the bumpers' types. Calculate the number of positions such that the ball will eventually fall from the game field if it starts at that position.


-----Input-----

The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper.


-----Output-----

Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position.


-----Examples-----
Input
4
<<><

Output
2
Input
5
>>>>>

Output
5
Input
4
>><<

Output
0


-----Note-----

In the first sample, the ball will fall from the field if starts at position 1 or position 2.

In the second sample, any starting position will result in the ball falling from the field.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
n = int(input())
stro = input()
ans = 0
x = 0
while stro[x] == '<' and x <= n - 1:
	x += 1
	ans += 1
	if x == n - 1 and stro[x] == '<':
		ans += 1
		break
	if x >= n:
		break
x = 1
while stro[-x] == '>' and x <= n:
	x += 1
	ans += 1
	if x == n and stro[-x] == '>':
		ans += 1
		break
	if x > n:
		break
print(ans)


t = int(input())
x = input()
a = x.find('>')
b = x.rfind('<')
if a == -1 or b == -1:
	print(t)
else:
	print(a - b + t - 1)


n = int(input())
s = input()
i = 0
while i < n and s[i] == '<':
	i += 1
j = n - 1
while j > -1 and s[j] == '>':
	j -= 1
print(i + n - j - 1)


from collections import deque
numLines = input()
bumperString = deque(input().strip())
numSolutions = 0
numPossibleSolutions = 0
lastBumper = '<'
foundBlackHole = False
while len(bumperString) > 0:
	bumper = bumperString.popleft()
	if bumper == '<':
		if lastBumper == '<':
			if foundBlackHole is False:
				numSolutions += 1
		elif lastBumper == '>':
			numPossibleSolutions = 0
			foundBlackHole = True
		lastBumper = '<'
	elif bumper == '>':
		if lastBumper == '<':
			numPossibleSolutions = 0 + numSolutions + 1
		elif lastBumper == '>':
			numPossibleSolutions += 1
		lastBumper = '>'
if numPossibleSolutions > 0:
	print(numPossibleSolutions)
else:
	print(numSolutions)


def main():
	n = int(input())
	s = input()
	ans = 0
	f = True
	for c in s:
		if c == '>':
			f = False
		if f:
			ans += 1
	f = True
	for c in reversed(s):
		if c == '<':
			f = False
		if f:
			ans += 1
	print(ans)
main()


n = int(input())
s = input()
ans = 0
for i in range(0, n):
	if s[i] == '<':
		ans += 1
	else:
		break
for i in range(n - 1, -1, -1):
	if s[i] == '>':
		ans += 1
	else:
		break
print(ans)


n = int(input())
s = input()
ans = 0
for c in s:
	if c == '<':
		ans += 1
	else:
		break
for c in reversed(s):
	if c == '>':
		ans += 1
	else:
		break
print(ans)


import sys
n = int(sys.stdin.readline())
field = sys.stdin.readline()
count = 0
for i in range(n):
	if field[i] == '<':
		count += 1
	else:
		break
for i in range(n - 1, -1, -1):
	if field[i] == '>':
		count += 1
	else:
		break
print(count)


n = int(input())
S = input()
k = 0
v = 0
d = 0
for i in range(n):
	if S[i] == '<' and v == 0:
		k = k + 1
	else:
		v = 1
	if v == 1 and S[i] == '>':
		d = d + 1
	else:
		d = 0
print(d + k)


import sys, math
sys.setrecursionlimit(10 ** 8)
n = int(input())
s = input()
x = 0
(j, k) = (0, n - 1)
for i in range(n):
	if j <= k and s[j] == '<':
		x += 1
		j += 1
	elif j <= k and s[k] == '>':
		x += 1
		k -= 1
print(x)


n = int(input())
st = input()
pos = 0
for i in range(n):
	if st[i] == '<':
		pos += 1
	else:
		break
for i in range(n):
	if st[n - 1 - i] == '>':
		pos += 1
	else:
		break
print(pos)


nr_of_bumpers = int(input())
bumper_types = list(input())
fall_bumpers = 0
bumper_index = 0
while bumper_index < nr_of_bumpers and bumper_types[bumper_index] == '<':
	fall_bumpers += 1
	bumper_index += 1
bumper_index = nr_of_bumpers - 1
while bumper_index >= 0 and bumper_types[bumper_index] == '>':
	fall_bumpers += 1
	bumper_index -= 1
print(fall_bumpers)


import sys
import math
x = 0
l = int(input())
s = input()
i = 0
while i < l:
	if s[i] == '<':
		x += 1
		i += 1
	else:
		i = l
i = l - 1
while i >= 0:
	if s[i] == '>':
		x += 1
		i -= 1
	else:
		i = -1
print(x)
sys.exit()


n = int(input())
s = []
r = 1
u = 0
for x in input():
	if x == '>':
		s.append(0)
	else:
		s.append(1)
for i in range(n):
	r *= s[i]
	if r != 0:
		u += 1
	else:
		break
r = 1
for i in range(n):
	if s[n - i - 1] == 0:
		r = 1
	else:
		r = 0
	if r == 1:
		u += 1
	else:
		break
print(u)


N = int(input())
S = input()
ans = 0
i = 0
while i < N and S[i] == '<':
	ans += 1
	i += 1
i = N - 1
while i >= 0 and S[i] == '>':
	ans += 1
	i -= 1
print(ans)


n = input()
s = input()
i = 0
ans = 0
while i <= len(s) - 1 and s[i] == '<':
	ans += 1
	i += 1
i = len(s) - 1
while i >= 0 and s[i] == '>':
	ans += 1
	i -= 1
print(ans)


n = int(input())
s = input()
b = 0
c = 0
if s[0] == '<':
	for i in range(n):
		if s[i] == '<':
			b += 1
		else:
			break
if s[n - 1] == '>':
	i = n - 1
	while i > -1:
		if s[i] == '>':
			c += 1
		else:
			break
		i -= 1
print(b + c)


a = int(input())
b = input()
tot = 0
if b[0] == '<':
	ind = b.find('>')
	if ind == -1:
		tot += a
	else:
		tot += b.find('>')
if b[-1] == '>':
	ind = a - b[::-1].find('<')
	if ind == a + 1:
		tot += a
	else:
		tot += a - ind
print(tot)


a = input()
bumpers = input()
counter = 0
for i in range(len(bumpers)):
	if bumpers[i] == '<':
		counter += 1
	else:
		break
for i in range(1, len(bumpers) + 1):
	if bumpers[-i] == '>':
		counter += 1
	else:
		break
print(counter)


from sys import stdin, stdout
n = int(stdin.readline().replace('\n', ''))
bumps = list(stdin.readline().replace('\n', ''))
total = 0
for bump in bumps:
	if bump == '<':
		total += 1
	else:
		break
for bump in bumps[::-1]:
	if bump == '>':
		total += 1
	else:
		break
stdout.write(str(total))


n = int(input())
s = input()
(ans, i) = (0, 0)
while i < n and s[i] != '>':
	i += 1
	ans += 1
i = n - 1
while i >= 0 and s[i] != '<':
	i -= 1
	ans += 1
print(ans)


n = int(input())
s = input()
(ans, ans1) = (0, 0)
w = 0
if s[n - 1] == '>':
	x = s[::-1]
	t = 0
	for i in range(len(x)):
		if x[i] != '>':
			ans1 = i
			t = 1
			break
		elif i == len(s) - 1 and x[len(s) - 1] == '>' and (t == 0):
			ans1 = i + 1
if s[0] == '<':
	f = 0
	for i in range(len(s)):
		if s[i] != '<':
			ans = i
			f = 1
			break
		elif i == len(s) - 1 and s[len(s) - 1] == '<' and (f == 0):
			ans = i + 1
elif s[0] != '<' and s[len(s) - 1] != '>':
	print(0)
	w = 1
if w == 0:
	print(ans + ans1)


from sys import stdin

def solve(bumpers):
	result = 0
	for bumper in bumpers:
		if bumper == '<':
			result += 1
		else:
			break
	for bumper in reversed(bumpers):
		if bumper == '>':
			result += 1
		else:
			break
	return result
if True:
	next(stdin)
	print(str(solve(next(stdin).strip('\r\n'))))
else:
	bumpers = ['<<><', '>>>>>', '>><<', '', '<<>>', '><>', '>>>><', '><<<<']
	for test_word in bumpers:
		print(str(solve(test_word)))


n = int(input())
s = input().lstrip('<').rstrip('>')
print(n - len(s))


import re
n = int(input())
s = input()
(prefix, ending) = (0, 0)
if s[0] == '<':
	prefix = len(re.findall('[<]+', s)[0])
if s[-1] == '>':
	ending = len(re.findall('[>]+', s[::-1])[0])
print(prefix + ending)


n = int(input())
s = input()
t = 0
i = 0
if s[0] == '<':
	while s[i] == '<':
		t = t + 1
		i += 1
		if i == n:
			break
i = n - 1
if s[n - 1] == '>':
	while s[i] == '>':
		t = t + 1
		i -= 1
		if i < 0:
			break
print(t)


n = int(input())
s = input()
if s[0] != '<' and s[-1] != '>':
	print(0)
elif s[0] != '<':
	if '<' in s:
		print(len(s) - s.rindex('<') - 1)
	else:
		print(len(s))
elif s[-1] != '>':
	if '>' in s:
		print(s.index('>'))
	else:
		print(len(s))
else:
	print(s.index('>') + len(s) - s.rindex('<') - 1)


n = int(input())
s = input()
k = s.count('><')
if k == 0:
	pass
elif k == 1:
	k = s.find('><')
	for i in range(k + 1, n):
		if s[i] == '<':
			n -= 1
		else:
			break
	for i in range(k, -1, -1):
		if s[i] == '>':
			n -= 1
		else:
			break
else:
	k = s.rfind('><')
	for i in range(k + 1, n):
		if s[i] == '<':
			n -= 1
		else:
			break
	q = s.find('><')
	for i in range(q, -1, -1):
		if s[i] == '>':
			n -= 1
		else:
			break
	n -= k - q
print(n)


n = int(input())
p = 0
s = input()
for i in range(len(s)):
	if s[i] == '<':
		p += 1
	else:
		break
for i in range(len(s) - 1, -1, -1):
	if s[i] == '>':
		p += 1
	else:
		break
print(p)


(n, st) = (int(input()), input())
i = 0
ans = 0
while i < n and st[i] == '<':
	ans += 1
	i += 1
i = n - 1
while i >= 0 and st[i] == '>':
	ans += 1
	i -= 1
print(ans)


n = int(input())
s = input()
l = 0
pos = 0
for i in range(len(s)):
	if s[i] == '>':
		l += 1
		if l == 1:
			pos = i
r = s.rfind('<')
ans = 0
if l > 0 and pos < r:
	ans = r - pos + 1
print(len(s) - ans)


n = int(input())
s = input()
count = 0
for l in s:
	if l == '<':
		count += 1
	else:
		break
for l in s[::-1]:
	if l == '>':
		count += 1
	else:
		break
print(count)


n = int(input())
s = input()

def solve():
	off = 0
	for (i, c) in enumerate(s):
		if c == '>':
			off = i
			break
	else:
		return len(s)
	for (i, c) in enumerate(reversed(s)):
		if c == '<':
			off += i
			break
	else:
		return len(s)
	return off
print(solve())


cnt = 0
n = int(input())
bumps = input()
for i in range(n):
	if bumps[i] == '>':
		break
	cnt += 1
for i in range(n):
	if bumps[n - i - 1] == '<':
		break
	cnt += 1
print(cnt)


N = int(input())
Bumper = input()
Checked = [False for i in range(N)]
i = 0
while i < N and Bumper[i] == '<':
	Checked[i] = True
	i += 1
i = N - 1
while i >= 0 and Bumper[i] == '>' and (Checked[i] != True):
	Checked[i] = True
	i -= 1
print(Checked.count(True))


import sys
input = sys.stdin.readline
k = int(input())
n = input().strip()
counter = 0
for i in n:
	if i == '<':
		counter += 1
	else:
		break
for i in n[::-1]:
	if i == '>':
		counter += 1
	else:
		break
print(counter)


n = int(input())
b = input()
c = 0
if b[0] == '>' and b[n - 1] == '<':
	print(0)
else:
	right = -1
	left = -1
	for i in range(n):
		if b[i] == '>' and right == -1:
			right = i
		elif right >= 0 and b[i] == '<':
			left = i
	if right >= 0 and left >= 0:
		print(n - (left - right + 1))
	else:
		print(n)


n = int(input())
bumpers = input()
a = n
for x in range(n):
	if bumpers[x] != '<':
		a = x
		break
bumpers = bumpers[::-1]
b = n
for x in range(n):
	if bumpers[x] != '>':
		b = x
		break
print(a + b)


N = int(input())
comm = input()
tot = 0
for i in range(N):
	if comm[i] == '<':
		tot += 1
	else:
		break
for i in range(N - 1, -1, -1):
	if comm[i] == '>':
		tot += 1
	else:
		break
print(tot)


__author__ = 'Alexander'
import sys
n = int(sys.stdin.readline().strip())
a = sys.stdin.readline().strip()
counter = 0
for i in range(len(a)):
	if a[i] == '<':
		counter += 1
	else:
		break
for i in range(1, len(a) + 1):
	if a[-i] == '>':
		counter += 1
	else:
		break
sys.stdout.write(str(counter))


n = int(input())
s = input()
f = 0
l = 0
for i in range(0, n):
	if s[i] == '<':
		f = f + 1
	else:
		break
for i in range(0, n):
	if s[n - 1 - i] == '>':
		l = l + 1
	else:
		break
print(l + f)


n = int(input())
s = input()
(a, res, c) = (s[0], 0, 0)
for i in range(n):
	if s[i] == '<':
		res += 1
	else:
		break
for i in range(n - 1, -1, -1):
	if s[i] == '>':
		res += 1
	else:
		break
print(res)


n = int(input())
s = input()
t = '<'
for x in range(n):
	if t != s[x]:
		break
else:
	x += 1
s = s[::-1]
t = '>'
for y in range(n):
	if t != s[y]:
		break
else:
	x += 1
print(x + y)


from sys import stdin

def main():
	(n,) = stdin_get_ints_from_line()
	s = stdin_get_string_from_line()
	res = 0
	for x in s:
		if x == '<':
			res += 1
		else:
			break
	for x in reversed(s):
		if x == '>':
			res += 1
		else:
			break
	print(res)
	return

def stdin_get_ints_from_line():
	return (int(x) for x in stdin.readline().strip().split(' '))

def stdin_get_ints_list_from_line():
	return list((int(x) for x in stdin.readline().strip().split(' ')))

def stdin_get_string_from_line():
	return stdin.readline().strip()
main()


from collections import deque, defaultdict, Counter
from itertools import product, groupby, permutations, combinations
from math import gcd, floor, inf
from bisect import bisect_right, bisect_left
n = input()
s = input()
ans = 0
for char in s:
	if char == '>':
		break
	else:
		ans += 1
for char in s[::-1]:
	if char == '<':
		break
	else:
		ans += 1
print(ans)


import math
answ = 0
b = input()
a = input()
count_1_total = a.count('<')
count_2_total = a.count('>')
count_1 = count_2 = 0
for i in range(len(a)):
	if a[i] is '<':
		count_1 = count_1 + 1
		if abs(count_1 - count_2) >= i + 1:
			answ = answ + 1
	elif a[i] is '>':
		count_2 = count_2 + 1
		if abs(count_1_total - count_1 - (count_2_total - count_2 + 1)) >= len(a) - i:
			answ = answ + 1
print(answ)


n = int(input())
s = input()
res = 0
for c in s:
	if c == '<':
		res += 1
	else:
		break
for c in s[::-1]:
	if c == '>':
		res += 1
	else:
		break
print(res)


n = int(input())
s = input()
c1 = 0
c2 = 0
for i in range(n):
	if s[i] == '<':
		c1 += 1
	else:
		break
for i in range(n - 1, -1, -1):
	if s[i] == '>':
		c2 += 1
	else:
		break
print(c1 + c2)


n = int(input())
plateau = input()
i = 0
while n > i and plateau[i] == '<':
	i += 1
j = n - 1
while j >= 0 and plateau[j] == '>':
	j -= 1
if i > j:
	print(n)
else:
	print(i + (n - 1 - j))


import sys
lenOfPattern = int(sys.stdin.readline())
pattern = sys.stdin.readline().strip('\n')
if '>' in pattern and '<' in pattern:
	a = pattern.find('>')
	b = pattern.rfind('<')
	pattern = list(pattern)
	del pattern[a:b + 1]
sys.stdout.write(str(len(pattern)))


n = int(input())
s = input()
cnt = 0
for i in s:
	if i != '<':
		break
	cnt += 1
for i in s[::-1]:
	if i != '>':
		break
	cnt += 1
print(cnt)


i = int(input())
c = input()
n = 0
for j in c:
	if j == '<':
		n += 1
	else:
		break
j = len(c) - 1
while j > -1:
	if c[j] == '>':
		n += 1
		j -= 1
	else:
		break
print(n)


num = int(input())
s = input()
a = s.find('>')
b = s.rfind('<')
num = 0
if a > b or a == -1 or b == -1:
	num = len(s)
elif a < b:
	num = len(s) - (b - a + 1)
print(num)


__author__ = 'Think'
n = int(input())
bumpers = input()
total = 0
for i in bumpers:
	if i == '<':
		total += 1
	else:
		break
for i in reversed(bumpers):
	if i == '>':
		total += 1
	else:
		break
print(total)


input()
c = list(input())
count = 0
for i in c:
	if '>' in i:
		break
	count += 1
for i in reversed(c):
	if '<' in i:
		break
	count += 1
print(str(count))


n = int(input())
s = input()
(left, right) = ([0] * n, [0] * n)
cur = 0
for i in range(n):
	if s[i] == '<':
		cur -= 1
	else:
		cur += 1
	left[i] = cur
cur = 0
for i in reversed(range(n)):
	if s[i] == '<':
		cur -= 1
	else:
		cur += 1
	right[i] = cur
ans = 0
for i in range(n):
	if s[i] == '<':
		if -left[i] == i + 1:
			ans += 1
	elif right[i] == n - i:
		ans += 1
print(ans)


n = int(input())
b = str(input().strip())
count = 0
left_end = -1
for i in range(len(b)):
	if b[i] == '<':
		count += 1
		left_end = i
	else:
		break
for i in range(len(b) - 1, -1, -1):
	if b[i] == '>' and i > left_end:
		count += 1
	else:
		break
print(count)


import sys
n = int(input())
a = input()
if len(set(a)) == 1:
	print(n)
	return
res = 0
i = 0
while i < n and a[i] == '<':
	res += 1
	i += 1
i = n - 1
while i >= 0 and a[i] == '>':
	res += 1
	i -= 1
print(res)


(n, x) = (int(input()), input())
print(n - len(x.lstrip('<').rstrip('>')))


from sys import stdin
n = int(input())
li = input()
a = li.find('>')
b = li.rfind('<')
if a == -1 or b == -1:
	print(n)
else:
	print(a + n - b - 1)


n = int(input())
bumpers = input()
leftCount = 0
for n in range(0, len(bumpers)):
	if bumpers[n] is '<':
		leftCount += 1
	else:
		break
rightCount = 0
for n in range(len(bumpers) - 1, -1, -1):
	if bumpers[n] is '>':
		rightCount += 1
	else:
		break
print(rightCount + leftCount)


print(int(input()) - len(input().lstrip('<').rstrip('>')))


n = int(input())
s = str(input())
ans1 = 0
ans2 = 0
i = 0
while s[i] == '<' and i < n:
	ans1 += 1
	i += 1
	if i == n:
		break
i = n - 1
while s[i] == '>' and i >= 0:
	ans2 += 1
	i -= 1
	if i == -1:
		break
print(min(n, ans1 + ans2))


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
n = ii()
s = input()
ans = 0
i = 0
while i < n and s[i] == '<':
	ans += 1
	i += 1
i = n - 1
while i > -1 and s[i] == '>':
	ans += 1
	i -= 1
print(ans)


n = int(input())
t = input()
d = {'<': 0, '>': 0}
count = 0
for i in range(n):
	if t[i] == '<':
		count = count + 1
	else:
		break
for i in range(n - 1, -1, -1):
	if t[i] == '>':
		count = count + 1
	else:
		break
print(count)


import sys
size = int(sys.stdin.readline())
board = sys.stdin.readline()
revboard = board[::-1]
good = 0
for i in board:
	if i == '<':
		good += 1
	elif i == '>':
		break
for i in revboard:
	if i == '>':
		good += 1
	elif i == '<':
		break
print(good)


n = int(input())
a = list(input())
left = 0
right = 0
for i in range(0, n):
	if a[i] == '<':
		left += 1
	else:
		break
for i in reversed(range(0, n)):
	if a[i] == '>':
		right += 1
	else:
		break
print(left + right)


size = int(input())
s = input()
r = 0
for i in range(size):
	if s[i] == '<':
		r += 1
	else:
		break
for i in range(size - 1, -1, -1):
	if s[i] == '>':
		r += 1
	else:
		break
print(r)


n = int(input())
s = input()
ind1 = s.find('>')
ind2 = s.rfind('<')
print(n if ind1 == -1 or ind2 == -1 else n - (ind2 - ind1 + 1))


n = int(input())
s = input()
s = list(s)
count = 0
for i in range(len(s)):
	if s[i] == '<':
		count += 1
	else:
		break
for i in range(len(s) - 1, -1, -1):
	if s[i] == '>':
		count += 1
	else:
		break
print(count)


n = int(input())
s = input()
k = s[0]
res = i = 0
while i <= n - 1 and s[i] == k:
	i += 1
else:
	if k == '<':
		res += i
k = '>'
i = n - 1
while i >= 0 and s[i] == k:
	i -= 1
else:
	res += n - i - 1
print(res)


n = int(input())
data = [i for i in input()]
ret = 0
ind = 0
if data[ind] == '<':
	while 1:
		if ind < n and data[ind] == '<':
			ret += 1
			ind += 1
		else:
			break
ind = n - 1
if data[ind] == '>':
	while 1:
		if ind > -1 and data[ind] == '>':
			ret += 1
			ind -= 1
		else:
			break
print(ret)


def main():
	num = input()
	signal = list(input())
	len_signal = len(signal)
	if signal[0] == '<':
		try:
			left_num = signal.index('>')
		except ValueError:
			return len_signal
	else:
		left_num = 0
	signal.reverse()
	if signal[0] == '>':
		try:
			right_num = signal.index('<')
		except ValueError:
			return len_signal
	else:
		right_num = 0
	return left_num + right_num
print(main())


n = int(input())
letts = input()
tot = 0
for i in range(n):
	if letts[i] != '<':
		break
	tot += 1
cur = tot
for i in range(n - cur):
	if letts[n - i - 1] != '>':
		break
	tot += 1
print(tot)


(n, seq) = (int(input()), input())
(idx, ans) = (0, 0)
while idx < n and seq[idx] == '<':
	ans += 1
	idx += 1
idx = n - 1
while idx > -1 and seq[idx] == '>':
	ans += 1
	idx -= 1
print(ans)


n = int(input())
s = str(input())
i = 0
while i < n and s[i] == '<':
	i += 1
if i == n:
	print(n)
else:
	j = n - 1
	while j >= 0 and s[j] == '>':
		j -= 1
	print(i + (n - j - 1))


def main():
	n = int(input())
	s = input()
	count = 0
	i = 0
	while i < n and s[i] == '<':
		count += 1
		i += 1
	i = n - 1
	while i > -1 and s[i] == '>':
		count += 1
		i -= 1
	print(count)

def __starting_point():
	main()
__starting_point()


import math, sys, re, itertools, pprint
(ri, rai) = (lambda : int(input()), lambda : list(map(int, input().split())))
n = ri()
a = input()
res = i = 0
while i < n and a[i] == '<':
	res += 1
	i += 1
i = n - 1
while i >= 0 and a[i] == '>':
	res += 1
	i -= 1
print(res)


input()
s = input()
j = 0
while j < len(s) and s[j] == '<':
	j += 1
k = len(s) - 1
while k >= 0 and s[k] == '>':
	k -= 1
print(j + len(s) - k - 1)


def main():
	(n, s) = (int(input()), input())
	(l, v, m) = ([0] * n, [False] * (n + 1), 1)
	for (i, f) in enumerate(l):
		if not f:
			while not l[i]:
				l[i] = m
				i += (-1, 1)[s[i] == '>']
				if not 0 <= i < n:
					v[m] = True
					break
			else:
				v[m] = v[l[i]]
			m += 1
	print(sum((1 for f in l if v[f])))
main()


def main():
	x = int(input())
	lst = input()
	count = 0
	for i in range(len(lst)):
		if lst[i] == '>':
			break
		count += 1
	for i in range(len(lst) - 1, -1, -1):
		if lst[i] == '<':
			break
		count += 1
	return count
print(main())


input()
s = input()
first = s[0]
last = s[-1]
answ = 0
if first == '<':
	for i in range(len(s)):
		if s[i] == first:
			answ += 1
		else:
			break
if last == '>':
	for i in range(len(s) - 1, -1, -1):
		if s[i] == last:
			answ += 1
		else:
			break
print(answ)


n = int(input())
directions = input()
tempcount = 0
for i in range(n):
	if directions[i] == '<':
		tempcount += 1
	else:
		break
for i in range(n - 1, -1, -1):
	if directions[i] == '>':
		tempcount += 1
	else:
		break
print(tempcount)


import re
from sys import argv, exit

def get_str():
	return input()

def get_int():
	return int(input())

def get_ints():
	return [int(i) for i in input().split(' ')]

def prnt(*args):
	if '-v' in argv:
		print(*args)
n = get_int()
s = get_str()
le = '<'
ri = '>'
nofall = '>+<+'
total = n
lin = -1
rin = -1
for (i, c) in enumerate(s):
	prnt(c)
	if c == ri:
		lin = i
		break
for (i, c) in enumerate(s):
	i = len(s) - i - 1
	c = s[i]
	prnt(c)
	if c == le:
		rin = i
		break
prnt('after filter', lin, rin)
if rin == -1 or lin == -1:
	prnt(-1)
	print(n)
	exit(0)
if lin > rin:
	prnt('backwards')
	print(n)
	exit(0)
diff = rin + 1 - lin
prnt('diff', diff)
print(n - diff)


n = int(input())
board = input()
ans = 0
for i in range(n):
	if board[i] == '>':
		break
	ans += 1
for i in range(n):
	if board[-i - 1] == '<':
		break
	ans += 1
print(ans)


n = int(input())
s = input()
nn = 0
while nn == 0:
	try:
		l = s.index('><')
		l1 = 0
		for i in range(l + 2, len(s)):
			if s[i] == '<':
				l1 += 1
			else:
				break
		l2 = 0
		for i in range(l - 1, -1, -1):
			if s[i] == '>':
				l2 += 1
			else:
				break
		s = s[0:l - l2] + s[l + 2 + l1:]
	except:
		break
print(len(s))


n = int(input())
strn = input()
sum = 0
for i in range(0, n):
	if strn[i] == '<':
		sum += 1
	else:
		break
for i in reversed(strn):
	if i == '>':
		sum += 1
	else:
		break
print(sum)


n = int(input())
bumpers = input()
right = bumpers.find('>')
left = bumpers[::-1].find('<')
if right == -1 or left == -1:
	print(n)
else:
	print(n + right - (n - left))


n = input()
str = input()
count1 = 0
count2 = 0
for i in range(len(str)):
	if str[i] == '>' and i + 1 < len(str) and (str[i + 1] == '<'):
		k = i + 1
		while k < len(str) and str[k] == '<':
			count2 -= 1
			k += 1
		count1 = 0
		continue
	if str[i] == '>':
		count1 += 1
	else:
		count2 += 1
print(count1 + count2)


input()
s = input()
n = len(s)
rs = 0
for i in range(n):
	if s[i] == '<':
		rs += 1
	else:
		break
for i in range(n - 1, -1, -1):
	if s[i] == '>':
		rs += 1
	else:
		break
print(rs)


n = int(input())
w = input()
c = 0
for i in w:
	if i == '<':
		c = c + 1
	else:
		break
n = n - 1
while n >= 0:
	if w[n] == '>':
		c = c + 1
		n = n - 1
	else:
		break
print(c)


n = int(input(''))
p = input('')
i = 0
j = n - 1
ans = 0
ans = int(ans)
a = '<'
b = '>'
while p[i] == a:
	i = i + 1
	if i == n:
		ans = ans + 1
		break
	ans = ans + 1
while p[j] == b:
	j = j - 1
	if j < 0:
		ans = ans + 1
		break
	ans = ans + 1
print(ans)


n = int(input())
s = input()
begin = True
counter = 0
ans = 0
for i in range(n):
	if begin and s[i] == '<':
		ans += 1
	elif s[i] == '>':
		counter += 1
		begin = False
	else:
		counter = 0
print(ans + counter)


n = int(input())
arr = input()
count = 0
for i in range(n):
	if arr[i] == '>':
		break
	count += 1
for i in range(n - 1, -1, -1):
	if arr[i] == '<':
		break
	count += 1
print(count)


import sys
fin = sys.stdin
fout = sys.stdout
n = int(fin.readline())
count = 0
s = fin.readline().strip()
temp = 0
for i in range(len(s) - 1, -1, -1):
	if s[i] == '>':
		temp = 0
	else:
		temp += 1
count += temp
temp = 0
for i in range(len(s)):
	if s[i] == '<':
		temp = 0
	else:
		temp += 1
count += temp
fout.write(str(count))


def pinball(n, s):
	(result, i) = (0, 0)
	while i < n and s[i] == '<':
		result += 1
		i += 1
	i = n - 1
	while i >= 0 and s[i] == '>':
		result += 1
		i -= 1
	return result
m = int(input())
t = input()
print(pinball(m, t))


n = int(input())
s = input()
l = True
k = 0
k1 = 0
for i in s:
	if i == '<' and l:
		k += 1
	if i == '>':
		k1 += 1
		l = False
	if i == '<' and (not l):
		k1 = 0
print(k + k1)


n = int(input())
s = input()
ind1 = 0
ind2 = n - 1
cont = 0
while s[ind1] == '<':
	cont += 1
	ind1 += 1
	if ind1 == n:
		break
while s[ind2] == '>' and ind2 >= 0:
	cont += 1
	ind2 -= 1
print(cont)


n = int(input())
s = input()
cnt = 0
for i in range(n):
	if s[i] == '<':
		cnt += 1
	else:
		break
s = s[::-1]
for j in range(n):
	if s[j] == '>':
		cnt += 1
	else:
		break
print(cnt)


n = int(input())
s = input()
result = 0
for ch in s:
	if ch == '<':
		result += 1
	else:
		break
for ch in s[::-1]:
	if ch == '>':
		result += 1
	else:
		break
print(result)


n = int(input())
s = input()
wyn = 0
l = 0
while l < n:
	if s[l] == '<':
		wyn += 1
		l += 1
	else:
		break
l = n - 1
while l >= 0:
	if s[l] == '>':
		wyn += 1
		l -= 1
	else:
		break
print(wyn)


n = int(input())
s = list(input())
l = 0
r = 0
p = 0
q = 0
for i in range(len(s)):
	if s[i] == '>':
		p += 1
		break
if p == 0:
	l += n
else:
	l += i
s.reverse()
for i in range(len(s)):
	if s[i] == '<':
		q += 1
		break
if q == 0:
	r += n
else:
	r += i
print(l + r)


num = int(input())
bumper = str(input())
bumperlist = list(bumper)
fallright = 0
fallleft = 0
for i in range(num):
	if bumperlist[i] == '<':
		fallleft += 1
	else:
		break
for i in reversed(range(num)):
	if bumperlist[i] == '>':
		fallleft += 1
	else:
		break
print(str(fallright + fallleft))


import sys
import math
import bisect

def solve(s):
	n = len(s)
	ans = 0
	for i in range(n):
		if s[i] == '<':
			ans += 1
		else:
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '>':
			ans += 1
		else:
			break
	return ans

def main():
	n = int(input())
	s = input()
	ans = solve(s)
	print(ans)
main()


(n, s) = (int(input()), input())
if '<' not in s or '>' not in s:
	print(n)
else:
	print(s.find('>') + (n - 1 - s.rfind('<')))


n = int(input())
a = input()
print(n - len(a.lstrip('<').rstrip('>')))


n = int(input())
l = input().lstrip('<').rstrip('>')
print(n - len(l))


n = int(input())
bumpers = input()
pos = 0
if bumpers[0] == '<':
	for i in range(len(bumpers)):
		if bumpers[i] == '<':
			pos += 1
		else:
			break
if bumpers[-1] == '>':
	for i in range(len(bumpers) - 1, -1, -1):
		if bumpers[i] == '>':
			pos += 1
		else:
			break
print(pos)


n = int(input())
v = input()
count = 0
right = 0
left = 0
second = 0
for i in range(0, len(v)):
	if v[i] == '<' and right == 0:
		count += 1
	if v[i] == '<' and right == 1:
		second = 0
	if v[i] == '>':
		second += 1
		right = 1
print(max(count + second, 0))


n = int(input())
s = input()
l = 0
ans = 0
while l < len(s) and s[l] == '<':
	ans += 1
	l += 1
r = n - 1
while r >= 0 and s[r] == '>':
	ans += 1
	r -= 1
print(ans)


n = int(input())
s = input()
right = False
right_c = 0
if s[0] == '>':
	right = True
	right_c = 1
i = 1
c = 1
ans = 1
peres = False
while i < len(s):
	if s[i] == '<' and right:
		right = False
		peres = True
		ans -= right_c
		c = 0
		right_c = 0
	elif s[i] == '<' and peres:
		right = False
		right_c = 0
	else:
		peres = False
		if s[i] == '>':
			right = True
			right_c += 1
		else:
			right = False
			right_c = 0
		c += 1
		ans += 1
	i += 1
print(ans)


a = input()
s = input()
l = 0
r = 0
for (i, ch) in enumerate(s):
	if ch == '>':
		break
	l += 1
for (i, ch) in enumerate(s):
	if s[-i - 1] == '<':
		break
	r += 1
print(l + r)


n = int(input())
s = input()
if len(set(s)) == 1:
	print(n)
else:
	a = s.index('<')
	b = s.index('>')
	s1 = s[::-1]
	c = s1.index('>')
	d = s1.index('<')
	p = 0
	if s[0] == '<':
		p = len(s[:b])
	if s[-1] == '>':
		p += len(s1[:d])
	print(p)


n = int(input())
s = input()
k = s.find('><')
while k != -1:
	beg = k
	end = k + 1
	while beg > 0 and s[beg - 1] == '>':
		beg -= 1
	while end < len(s) and s[end] == '<':
		end += 1
	s = s[:beg] + s[end:]
	k = s.find('><')
print(len(s))


input()
n = input()
i = 0
k = 0
for i in range(len(n)):
	if n[i] == '<':
		k += 1
	else:
		break
for i in range(len(n) - 1, -1, -1):
	if n[i] == '>':
		k += 1
	else:
		break
print(k)


import fileinput
num_args = 2
fall = 0
i = 0
for arg in range(num_args):
	if arg == 0:
		n = int(input())
	else:
		bumpers = input()
j = len(bumpers) - 1
while i <= len(bumpers) - 1 and bumpers[i] == '<':
	i += 1
	fall += 1
while j >= 0 and bumpers[j] == '>':
	j -= 1
	fall += 1
print(fall)


n = int(input())
bumper = input()
count = 0
for i in range(n):
	if bumper[i] == '<':
		count += 1
	else:
		break
for i in range(n - 1, -1, -1):
	if bumper[i] == '>':
		count += 1
	else:
		break
print(count)


def solve():
	n = int(input())
	s = input()
	c = 0
	for ch in s:
		if ch == '<':
			c += 1
		else:
			break
	for ch in s[::-1]:
		if ch == '>':
			c += 1
		else:
			break
	print(c)
solve()


n = int(input())
stri = input()
sums = 0
n = len(stri)
i = 0
while stri[i] == '<':
	sums += 1
	i += 1
	if i == n:
		break
i = n - 1
while stri[i] == '>':
	sums += 1
	i -= 1
	if i == -1:
		break
print(sums)


n = int(input())
s = input()
i = 0
(c1, c2) = (0, 0)
while i < n and s[i] == '<':
	c1 += 1
	i += 1
i = n - 1
while i >= 0 and s[i] == '>':
	c2 += 1
	i -= 1
print(c1 + c2)


n = int(input())
s = input()
count = 0
i = 0
while i < n and s[i] == '<':
	count += 1
	i += 1
i = n - 1
while i >= 0 and s[i] == '>':
	count += 1
	i -= 1
print(count)


n = int(input())
s = input()
pos = None
rights = 0
lefts = 0
for i in range(n - 1):
	if s[i] == '>' and s[i + 1] == '<':
		pos = i
		break
	elif s[i] == '<':
		lefts += 1
if pos != None:
	for i in range(n - 1, pos + 1, -1):
		if s[i] == '<' and s[i - 1] == '>':
			break
		elif s[i] == '>':
			rights += 1
	print(lefts + rights)
else:
	print(n)


n = input()
a = input()
l = a.find('>')
r = a.rfind('<')
if l == -1 or r == -1:
	print(len(a))
else:
	print(l + (len(a) - r - 1))


import sys
import math
input()
ar = list(input())
suma = 0
ar = ar + ['?']
for (n, i) in enumerate(ar):
	if i != '<':
		suma += n
		break
ar = ar[:len(ar) - 1]
ar = ['?'] + ar
ar = reversed(ar)
for (n, i) in enumerate(ar):
	if i != '>':
		suma += n
		break
print(suma)


n = int(input())
s = input()
r = 0
l = 0
ans = 0
f = False
if s[0] == '>':
	r += 1
else:
	l += 1
for i in range(1, n):
	if s[i] == s[i - 1] == '>':
		r += 1
	elif s[i] == s[i - 1] == '<':
		l += 1
	elif s[i] == '>':
		if f:
			ans += l
			l = 0
			r += 1
			f = False
		else:
			l = 0
			r += 1
	else:
		ans += r
		r = 0
		f = True
		l += 1
if f:
	ans += l
print(n - ans)


a = int(input())
t = input()
if '><' not in t:
	print(a)
else:
	p = 0
	b = t.index('><')
	if '>' not in t[0:b]:
		p += b
	else:
		for k in range(0, b):
			if t[k] == '<':
				p += 1
			else:
				break
	B = t[::-1].index('<>')
	if '<' not in t[::-1][0:B]:
		p += B
	else:
		for j in range(0, B):
			if t[::-1][j] == '>':
				p += 1
			else:
				break
	print(p)


n = int(input())
s = input()
prev = s[0]
k = 0
p = 0
res = []
for i in range(n):
	if s[i] != prev:
		res.append(k)
		prev = s[i]
		k = 1
	else:
		k += 1
if k:
	res.append(k)
for i in range(1, len(res) - 1):
	p += res[i]
if len(res) > 1 and s[0] == '>':
	p += res[0]
if len(res) > 1 and s[len(s) - 1] == '<':
	p += res[len(res) - 1]
print(n - p)


n = int(input())
a = input()
b = n
c = n
if '>' in a:
	b = a.index('>')
if '<' in a:
	c = a[::-1].index('<')
print(b + c)


N = int(input())
listy = input()
count = 0
for x in listy:
	if x == '<':
		count += 1
	else:
		break
for x in listy[::-1]:
	if x == '>':
		count += 1
	else:
		break
print(count)


Y = lambda : list(map(int, input().split()))
P = lambda : map(int, input().split())
N = lambda : int(input())
n = N()
s = input()
(l, r, ans) = (0, 0, 0)
if not (s[0] == '>' and s[len(s) - 1] == '<'):
	l = s.find('>')
	r = s[::-1].find('<')
	ans = n if l == -1 or r == -1 else l + r
print(ans)


n = int(input())
a = list(input())
count = 0
i = 0
while i != n:
	if a[i] == '<':
		count += 1
	else:
		break
	i += 1
if i != n:
	i = n - 1
	while i != -1:
		if a[i] == '>':
			count += 1
		else:
			break
		i -= 1
print(count)


input()
s = input()
c = 0
for x in s:
	if x == '>':
		break
	c += 1
for x in s[::-1]:
	if x == '<':
		break
	c += 1
print(c)


__author__ = 'artyom'

def main():
	n = read()
	s = read(0)
	c = 0
	while c < n and s[c] == '<':
		c += 1
	n -= 1
	while n >= 0 and s[n] == '>':
		n -= 1
		c += 1
	return c

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s)
write(main())


import math
import sys
n = input()
n = int(n)
a = input()
count = 0
mcount = 0
for i in range(n):
	if a[i] == '<':
		count += 1
	else:
		break
for i in range(n - 1, -1, -1):
	if a[i] == '>':
		count += 1
	else:
		break
print(count)


n = int(input())
s = input()
ans = 0
for x in s:
	if x == '<':
		ans += 1
	else:
		break
for x in s[::-1]:
	if x == '>':
		ans += 1
	else:
		break
print(ans)


a = int(input())
st = [x for x in input()]
total = 0
j = 0
while j <= len(st) - 1:
	if st[j] == '<':
		total += 1
		j += 1
	else:
		break
j = len(st) - 1
while j >= 0:
	if st[j] == '>':
		total += 1
		j -= 1
	else:
		break
print(total)


n = int(input())
s = input()
qt = 0
qb = 0
while s[n - qb - 1] == '>':
	qb += 1
	if qb == n:
		break
while s[qt] == '<':
	qt += 1
	if qt == n:
		break
print(qt + qb)


n = int(input())
s = input()
c = ['<', '>']
ans = 0
for j in range(2):
	i = 0
	while i < n:
		if s[i] == c[j]:
			i += 1
		else:
			break
	ans += i
	s = s[::-1]
print(ans)


n = int(input())
s = input()
t_l = 0
t_r = 0
for c in s:
	if c == '<':
		t_l += 1
	else:
		break
for c in s[::-1]:
	if c == '>':
		t_r += 1
	else:
		break
print(t_l + t_r)


n = int(input())
a = input()
x = -1
for i in range(0, n):
	if a[i] == '>':
		x = i
		break
if x == -1:
	print(n)
	exit(0)
i = n - 1
y = -1
while i > x:
	if a[i] == '<':
		y = i
		break
	i -= 1
if y == -1:
	print(n)
	exit(0)
print(x + n - y - 1)


n = int(input())
line = str(input())
num = 0
for it in line:
	if it == '<':
		num += 1
	else:
		break
for it in line[::-1]:
	if it == '>':
		num += 1
	else:
		break
print(num)


input()
s = input()
ans = 0
for i in s:
	if i == '<':
		ans += 1
	else:
		break
for i in s[::-1]:
	if i == '>':
		ans += 1
	else:
		break
print(ans)


n = int(input())
s = input()
i = 0
forwards = []
c = 0
while i < n:
	if s[i] == '>':
		forwards.append('>')
	elif not forwards:
		c += 1
	else:
		forwards = []
		try:
			i += s[i:].index('>')
			forwards.append('>')
		except:
			break
	i += 1
c += len(forwards)
print(c)


n = int(input())
bumpers = input()
izquierda = 0
derecha = 0
i = 0
while i < n:
	if bumpers[i] == '<':
		izquierda = izquierda + 1
	else:
		break
	i = i + 1
i = 0
while i < n:
	if bumpers[n - i - 1] == '>':
		derecha = derecha + 1
	else:
		break
	i = i + 1
respuesta = izquierda + derecha
print(respuesta)


n = int(input())
s = input()
pos = s.find('><')
if pos == -1:
	print(n)
else:
	ans = 0
	for i in s:
		if i == '>':
			break
		else:
			ans += 1
	for i in range(n - 1, -1, -1):
		t = s[i]
		if t == '<':
			break
		else:
			ans += 1
	print(ans)