Harryxun/stf_run huggingface dataset:
a = 0
s = input()
n = len(S)

for i in range(0,n):
    if s[i] == "+":
        a = a+1
    if s[i] == "-":
        a = a-1
        
print(a)

### FIXED CODE ###

a = 0
s = input()

for i in range(0,4):
    if s[i] == "+":
        a = a+1
    if s[i] == "-":
        a = a-1
        
print(int(a))
import numpy as np
n = int(input())

l = np.empty(n)
l[:] = np.nan
k = 0
for i in range(1,n):
  if n % i == 0:
    l[k] = int(i + (n / i))
    k += 1
print(np.nanmin(l))

### FIXED CODE ###

n = int(input())

for i in range(int(n ** 0.5)):
  if n % (int(n ** 0.5) - i) == 0:
    j = n // (int(n ** 0.5) - i)
    break
    
print(int(n ** 0.5) - i + j - 2)
n,k=map(input().split())
print(n-k+1)

### FIXED CODE ###

n,k=map(int,input().split())
print(n-k+1)
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
X=0;Y=0
mod=10**9+7
for i in range(n-1):
  X+=(a[i+1]-a[i])*(i+1)*(n-i-1)
  X%=mod
for i in range(n-1):
  Y+=(b[i+1]-b[i])*(i+1)*(n-i-1)
  Y%=mod
print(X*Y%mod)

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
X=0;Y=0
mod=10**9+7
for i in range(n-1):
  X+=(a[i+1]-a[i])*(i+1)*(n-i-1)
  X%=mod
for i in range(m-1):
  Y+=(b[i+1]-b[i])*(i+1)*(m-i-1)
  Y%=mod
print((X*Y)%mod)
import sys
# from collections import defaultdict
# from collections import Counter
# from queue import Queue
import math

def main():
    N = int(input())

    As = [int(s) for s in input().split()]
    logsum = 0
    prod = 1
    for a in As:
        logsum += math.log10(a)

    if logsum >= 18:
        print('-1')
        return

    for a in As:
        prod *= a

    print(prod)

    # As = []
    # for i in range(N):
    #     tmp = int(input())
    #     As.append(tmp)

    return 0

if __name__ == '__main__':
    sys.exit(main())


### FIXED CODE ###

import sys
# from collections import defaultdict
# from collections import Counter
# from queue import Queue
import math

def main():
    N = int(input())

    As = [int(s) for s in input().split()]
    logsum = 0
    prod = 1
    for a in As:
        if a == 0:
            print('0')
            return

        logsum += math.log10(a)
        # sys.stderr.write('{}\n'.format(logsum))


    if logsum > 18.2:
        print('-1')
        return

    for a in As:
        prod *= a

    if prod > 10 ** 18:
        print('-1')
        return
    print(prod)

    # As = []
    # for i in range(N):
    #     tmp = int(input())
    #     As.append(tmp)

    return 0

if __name__ == '__main__':
    sys.exit(main())
from scipy.special import comb

n, a, b = map(int, input().split())
total = 0
for i in range(1,n+1):
    if i == a or i == b:
        continue
    total += comb(n, i, exact=True)
print(total%(10**9+7))

### FIXED CODE ###

n, a, b = map(int, input().split())
mod = int(1e9+7)

def comb(r):
    bunshi = 1
    for i in range(n-r+1,n+1):
        bunshi = bunshi*i%mod
    bunbo = 1
    for i in range(1,r+1):
        bunbo = bunbo * i %mod
    return bunshi*pow(bunbo, mod-2,mod)%mod

ans = pow(2,n,mod) -1 - comb(b)-comb(a)
ans = (ans +2*mod)%mod
print(ans)
INF = 10 ** 20
n = int(input())
edges = [list(map(int, input().split())) for _ in range(n)]
dist = [[INF] * n for _ in range(n)]

edgeList = []
for i in range(n):
    for j in range(i, n):
        edgeList.append((edges[i][j], i, j))
edgeList.sort()

for k in range(n):
    for i in range(n):
        for j in range(n):
            dist[i][j] = min(dist[i][j], edges[i][k] + edges[k][j])
ans = 0
for c, i, j in edgeList:
    minCost = min([dist[i][k] + dist[k][j] for k in range(n) if (k != i and k != j)])
    if c > minCost:
        print(-1)
        break
    if c < minCost:
        ans += c

else:
    print(ans)

### FIXED CODE ###

INF = 10 ** 20
n = int(input())
edges = [list(map(int, input().split())) for _ in range(n)]
dist = [[INF] * n for _ in range(n)]

edgeList = []
for i in range(n):
    for j in range(i, n):
        edgeList.append((edges[i][j], i, j))
edgeList.sort()

for k in range(n):
    edgesk = edges[k]
    for i in range(n):
        disti = dist[i]
        edgesik = edges[i][k]
        for j in range(n):
            if disti[j] > edgesik + edgesk[j]:
                disti[j] = edgesik + edgesk[j]

ans = 0
for c, i, j in edgeList:
    minCost = INF
    for k in range(n):
        if k in (i, j):continue
        if minCost > dist[i][k] + dist[k][j]:
            minCost = dist[i][k] + dist[k][j]
    if c > minCost:
        print(-1)
        break
    if c < minCost:
        ans += c
else:
    print(ans)
N=int(input())
h=list(map(int,input().split()))
s=0
mini=100
def garden(N,h,s,mini):
  p=[]
  a=0
  b=0
  size=0
  for i in range (N):
    if mini>h[i]:
      mini=h[i]
    if i!=N-1:
      if h[i]>h[i+1]:
        p.append(h[i])
        a+=h[i]
        size+=1
    if i!=N-1 and i!=0:
      if h[i]<h[i+1] and (h[i]-h[i-1])*(h[i+1]-h[i])<=0:
        p.append(h[i])
        b+=h[i]
        size+=1
    if i==N-1:
      if h[i-1]<h[i]:
        p.append(h[i])
        a+=h[i]
        size+=1
  s+=a
  s-=b
  print(a)
  print(b)
  flag=0
  for j in range (1,size-1):
    if (p[j]-p[j-1])*(p[j+1]-p[j])>0:
      flag=1
  if flag==1:
    garden(size,p,s,mini)
  if s==0:
    s+=1
  print(s)
  
garden(N,h,s,mini)

### FIXED CODE ###

N=int(input())
h=list(map(int,input().split()))
s=h[0]
for i in range (1,N):
  if h[i]>h[i-1]:
    s+=(h[i]-h[i-1])
print(s)
N, M = [int(nm) for nm in input().split()]
X = [int(x) for x in input().split()]

if N > M:
  print(0)
else:
  X.sort()
  mn_X = X[0]
  for m in range(M):
    X[m] = X[m] - mn_X #一番座標が小さい点を原点とする

  DX = [] #隣り合う二点間の距離
  for mm in range(M-1):
    dx = X[mm+1] - X[mm] #隣り合う二点間の距離を求める
    DX.append(dx)
  print(DX)
  
  DXX = list(tuple(DX))
  DXX.sort(reverse=True) #DXXのi=0,1,2,...,N-2、つまり大きい値を取ってきたい
  I = [] #「XをN個に分割するとき、どの座標で分割するか」
  for i in range(N-1):
    big_dx = DXX[i]
    idx = DX.index(big_dx)
    I.append(idx)
  I.sort()
  print(I)
  
  #最初のコマは原点に置く
  move = X[I[0]] - 0
  print(move)
  
  for j in range(0, N-2):
    move += (X[I[j+1]] - X[I[j]+1])
  print(move)
  
  #最後のコマ
  move += (X[-1] - X[I[N-2]+1])
  
  print(move)

### FIXED CODE ###

N, M = [int(nm) for nm in input().split()]
X = [int(x) for x in input().split()]

if N >= M:
  print(0)
elif N == 1:
  ans = max(X) - min(X)
  print(ans)
else:
  X.sort()
  mn_X = X[0]
  for m in range(M):
    X[m] = X[m] - mn_X #一番座標が小さい点を原点とする

  DX = [] #隣り合う二点間の距離
  for mm in range(M-1):
    dx = X[mm+1] - X[mm] #隣り合う二点間の距離を求める
    DX.append(dx)
  #print(DX)
  
  DXX = list(tuple(DX))
  DXX.sort(reverse=True) #DXXのi=0,1,2,...,N-2、つまり大きい値を取ってきたい
  I = [] #「XをN個に分割するとき、どの座標で分割するか」
  for i in range(N-1):
    big_dx = DXX[i]
    idx = DX.index(big_dx)
    I.append(idx)
  I.sort()
  #print(I)
  
  #最初のコマは原点に置く
  move = X[I[0]] - 0
  #print(move)
  
  for j in range(0, N-2):
    move += (X[I[j+1]] - X[I[j]+1])
  #print(move)
  
  #最後のコマ
  move += (X[-1] - X[I[N-2]+1])
  
  print(move)
ninnzuu = (int)(input())
joushi = list(map(int, input().split(" ")))
buka = [0 for i in range(ninnzuu)]
for i in range(1, ninnzuu + 1):
    buka[joushi[i] - 1] += 1
for i in range(ninnzuu):
  print(buka[i])

### FIXED CODE ###

ninnzuu = (int)(input())
joushi = list(map(int, input().split(" ")))
buka = [0 for i in range(ninnzuu)]
for i in range(ninnzuu - 1):
    buka[joushi[i]] += 1
for i in range(1, ninnzuu):
  print(buka[i])
print(0)
n = int(input())
arr = list(map(int, input().split()))
ans = 0
for i in range(n):
    if arr[i] == i + 1:
        ans += 1
        arr[i+1], arr[i] = arr[i], arr[i+1]
if arr[n-1] == n:
    ans += 1
print (ans)   

### FIXED CODE ###

n = int(input())
arr = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    if arr[i] == i + 1:
        ans += 1
        arr[i+1], arr[i] = arr[i], arr[i+1]
if arr[n-1] == n:
    ans += 1
print (ans)
buy = [false]*1000
buy[0] = true
for i in range(100):
  if buy[i]:
    buy[i+4] = true
    buy[i+7] = true
    
n = int(input())
if buy[n]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

buy = [False]*1000
buy[0] = True
for i in range(100):
  if buy[i]:
    buy[i+4] = True
    buy[i+7] = True
    
n = int(input())
if buy[n]:
  print("Yes")
else:
  print("No")
import collections
N=int(input())
s=[int(input()) for i in range(N)]
M=int(input())
t=[int(input()) for i in range(M)]

table=collections.defaultdict(int)
for x in s:
  table[x]+=1
for x in t:
  table[t]+=1
table=table.values()
table=[x for x in table if x >= 0]
print(sum(table))

### FIXED CODE ###

import collections
N=int(input())
s=[input() for i in range(N)]
M=int(input())
t=[input() for i in range(M)]

table=collections.defaultdict(int)
for x in s:
  table[x]+=1
for x in t:
  table[x]-=1
table=table.values()
table=[x for x in table if x >= 0]
table.append(0)
print(max(table))
lines = input().split(" ")
K = int(lines[0])
X = int(lines[1])
arr = []

if K == 1:
  print(X)
else:
  for i in range(X , X + K):
    arr.append(i)
    
  for j in range(X - K + 1 , X):
    arr.append(j)
    
arr.sort()
print(arr.join(" "))

### FIXED CODE ###

lines = input().split(" ")
K = int(lines[0])
X = int(lines[1])
arr = []

if K == 1:
  print(X)
else:
  for i in range(X , X + K):
    arr.append(i)
    
  for j in range(X - K + 1 , X):
    arr.append(j)
    
arr.sort()
map_result = map(str, arr)
result = ' '.join(map_result)
print(result)
N = int(input())
if n % 2 != 0:
	print (((n+1)/2) /n)
else:
  print (2/n)

### FIXED CODE ###

n = int(input())
if n % 2 != 0:
	print (((n+1)/2) /n)
else:
	print ((n/2)/n)
N = int(input())
D = {}
for _ in range(N):
    S = "".join(sorted(input()))
    if S in D:
        D[S] += 1
    else:
        D[S] = 1
 
ans = 0
for i in D.values():
    out += i-1
print(out)

### FIXED CODE ###

N = int(input())
D = {}
for _ in range(N):
    S = "".join(sorted(input()))
    if S in D:
        D[S] += 1
    else:
        D[S] = 1
 
out = 0
for i in D.values():
    out += i * (i-1) //2
print(out)
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    import numpy as np
    n,d=map(int, input().split())
    l=[list(map(int,input().split())) for i in range(n)]
    cnt=0
    for j in range(n-1):
        for k in range(j+1,n):
            a=np.array(l[j])-np.array(l[k])
            if (np.linalg.norm(a))%1==0:
                cnt+=1
    print(cnt)
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    import numpy as np
    n,d=map(int, input().split())
    l=[list(map(int,input().split())) for i in range(n)]
    cnt=0
    for j in range(n-1):
        for k in range(j+1,n):
            a=np.array(l[j])-np.array(l[k])
            if (np.linalg.norm(a))%1==0:
                cnt+=1
    print(cnt)
resolve()
num =set([0,1,2,3,4,5,6,7,8,9])
n,k = input().split()
d = list(map(int,input().split()))
a = list(num - set(d))
a.sort()
ans =[]
for i in range(len(n)):
    for j in a:
        if int(n[i]) <= j:
            ans.append(a[i])
            break
    if a[-1] < int(n[i]):
        ans.append(a[0])
l = map(str,ans)
b = "".join(l)
if int(b) < int(n):
    if a[0] != 0:
        print(a[0]*(10**(len(n)))+int(b))
    else:
        print(a[1]*(10**(len(n))) + int(b))
else:
    print(int(b))

### FIXED CODE ###

n,k = map(int,input().split())
d = input().split()
while len(set(str(n)) & set(d)) !=0:
    n +=1
print(n)
n = input()
s = [''.join(sorted(input())) for i in range(n)]
count = 0
for i in range(n):
  for j in range(i+1,n):
    if s[j]==s[i]:
      count+=1
print(count)

### FIXED CODE ###

n = int(input())
d = dict()
for i in range(n):
  S = ''.join(sorted(list(input())))
  if S in d.keys():
    d[S] +=1
  else:
    d[S] = 1
 
ans = 0
for i in d.values():
  ans += i*(i-1)//2
print(ans)
from collections import deque
import sys
input = sys.stdin.readline
h,w=map(int, input().split(' '))
a = [list(input()) for i in range(h)]
q = deque()
for i in range(h):
    for j in range(w):
        if a[i][j] == "#":
            a[i][j] = 0
            q.append([i,j,0])
        else:
            a[i][j] = -1
while q:
    [s,t,cnt] = q.popleft()
    if s>0 and nl[s-1][t] == -1:
        q.append([s-1,t,cnt+1])
        a[s-1][t] = cnt+1
    if s<h-1 and nl[s+1][t] == -1:
        q.append([s+1,t,cnt+1])
        a[s+1][t] = cnt+1
    if t>0 and nl[s][t-1] == -1:
        q.append([s,t-1,cnt+1])
        a[s][t-1] = cnt+1
    if t<w-1 and nl[s][t+1] == -1:
        q.append([s,t+1,cnt+1])
        a[s][t+1] = cnt+1
ans = 0
for i in range(h):
    ans = max(ans,max(a[i]))
print(ans)

### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline
h,w=map(int, input().split(' '))
a = [input() for i in range(h)]
nl = [[] for i in range(h)]
q = deque()
for i in range(h):
    for j in range(w):
        if a[i][j] == "#":
            nl[i].append(0)
            q.append([i,j,0])
        else:
            nl[i].append(-1)
while q:
    [s,t,cnt] = q.popleft()
    if s>0 and nl[s-1][t] == -1:
        q.append([s-1,t,cnt+1])
        nl[s-1][t] = cnt+1
    if s<h-1 and nl[s+1][t] == -1:
        q.append([s+1,t,cnt+1])
        nl[s+1][t] = cnt+1
    if t>0 and nl[s][t-1] == -1:
        q.append([s,t-1,cnt+1])
        nl[s][t-1] = cnt+1
    if t<w-1 and nl[s][t+1] == -1:
        q.append([s,t+1,cnt+1])
        nl[s][t+1] = cnt+1
ans = 0
for i in range(h):
    ans = max(ans,max(nl[i]))
print(ans)
N, M = map(int, input().split())
s_c = [list(map(int, input().split())) for _ in range(M)]
 
if N == 1:
  a, b = 0, 10**N
elif N >= 2:
  a, b = 10**(N-1), 10**N
 
ans = '-1'
for i in range(a, b):
  flag = True
  for j in range(M):
    if str(i)[s_c[j][0]-1] != str(s_c[j][1]):
      flag = False
  if flag:
    ans = i
    break
 
print(ans)



n,m=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(m)]
if n==1:
  for i in range(10):
    tmp=str(i)
    flag=True
    for j in range(m):
      if tmp[arr[j][0]-1]!=str(arr[j][1]):
        flag=False
    if flag==True:
      print(i)
      break
  else:
    print(-1)
else:
  for i in range(10**(n-1),10**n):
    tmp=str(i)
    flag=True
    for j in range(m):
      if tmp[arr[j][0]-1]!=str(arr[j][1]):
        flag=False
    if flag==True:
      print(i)
      break
  else:
    print(-1)

### FIXED CODE ###

N, M = map(int, input().split())
s_c = [list(map(int, input().split())) for _ in range(M)]

if N == 1:
  a, b = 0, 10**N
elif N >= 2:
  a, b = 10**(N-1), 10**N

ans = '-1'
for i in range(a, b):
  flag = True
  for j in range(M):
    if str(i)[s_c[j][0]-1] != str(s_c[j][1]):
      flag = False
  if flag:
    ans = i
    break

print(ans)
n = int(input())
p = list(map(int, input().split()))
num = 0
    for i in range(1, n-1):
        if p[i-1] < p[i] < p[i+1] or p[i-1] > p[i] > p[i+1]:
            num += 1
    print(num)

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
num = 0
for i in range(1, n-1):
    if p[i-1] < p[i] < p[i+1] or p[i-1] > p[i] > p[i+1]:
        num += 1
print(num)
a,b,c,d = map(int,input().split())
if abs(a-b)=<d:
  if abs(b-c)=<d:
    print("Yes")
  else:
    print("No")
else:
  print("No")

### FIXED CODE ###

a,b,c,d=map(int,input().split())
if abs(c-a)<=d:
  print("Yes")
elif abs(c-b)<=d and abs(b-a)<=d:
  print("Yes")
else:
  print("No")
N = int(input())
W = list(map(int,input().split()))
m = sum(W)

for j in range(N-1):
    W1 = W[:j+1]
    W2 = W[j+1:N]
    s = abs(sum(W1) - sum(W2))
    m = min(m, s)

print(m)


### FIXED CODE ###

P,Q,R = map(int, input().split())
A = [P+Q, P+R, R+Q]
print(min(A))
S = input()
if S = "ARC":
    print('ABC')
else:
    print('ARC')

### FIXED CODE ###

S = input()
if S == "ARC":
    print('ABC')
else:
    print('ARC')
string = input()
count = 0
for i in range(len(string)):
  if string[i] == "A":
    count = 1
    while string[i] != "Z":
      count += 1
      i += 1 
print(count+1)

### FIXED CODE ###

string = input()
index_of_A = string.index("A")
index_of_Z = string.rfind("Z")

print(index_of_Z - index_of_A + 1)
#input
n, k = map(int, input().split())

#output
mod = pow(10, 9) + 7

def cmb(n, r):
    res = 1
    fac = 1
    for i in range(r):
        res *= (n-i)
        res %= mod
        fac *= (i+1)
        fac %= mod
    return res*pow(fac, mod-2, mod) % mod

if n <= k-1:
    print(cmb(2*n-1, m))
else:
    answer = 0
    for m in range(k+1):
        answer += cmb(n, m)*cmb(n-1, a) % mod

print(answer % mod)

### FIXED CODE ###

#input
n, k = map(int, input().split())

#output
mod = pow(10, 9) + 7

n_ = 4*10**5 + 5
fun = [1]*(n_+1)
for i in range(1,n_+1):
    fun[i] = fun[i-1]*i%mod
rev = [1]*(n_+1)
rev[n_] = pow(fun[n_],mod-2,mod)
for i in range(n_-1,0,-1):
    rev[i] = rev[i+1]*(i+1)%mod
def cmb(n,r):
    if n <= 0 or r < 0 or r > n: return 0
    return fun[n]*rev[r]%mod*rev[n-r]%mod

if n <= k-1:
    print(cmb(2*n-1, n))
else:
    answer = 0
    for m in range(k+1):
        answer += cmb(n, m)*cmb(n-1, m) % mod
        answer %= mod
    print(answer)
X,N = map(int,input().split())
if N > 0:
  p = list(map(int,input().split()))
a = 101
ans = 0
for i in range(-1,101):
  if N == 0:
    ans = X
    break
  if p.count(i) == 0 and a >= abs(X - i):
    a = abs(X - i)
    ans = i
for i in range(-1,101):
  if a == abs(X - i) and p.count(i) == 0:
    ans = i
    break
print(ans)

### FIXED CODE ###

X,N = map(int,input().split())
if N > 0:
  p = list(map(int,input().split()))
a = 102
ans = 0
for i in range(-1,200):
  if N == 0:
    ans = X
    break
  if p.count(i) == 0 and a > abs(X - i):
    a = abs(X - i)
    ans = i
print(ans)
S = int(input())
i = 0
C = 0

while i < 3:
  if S[i] == 1:
    C += 1
  i += 1
  
print(str(C))  

### FIXED CODE ###

s = str(input())

count = 0
for i in range(3):
    if s[i] == '1':
        count += 1

print(count)
import bisect

n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n - 1):
  a[i] -= 1
  a[i + 1] += a[i]
a[n - 1] -= 1

memo = {}
for i in range(n):
  if a[i] % k not in memo.keys():
    memo[a[i] % k] = [i]
  else:
    memo[a[i] % k].append(i)

ans = bisect.bisect_left(memo[0], k - 1)

for i in memo.keys():
  for j in range(len(memo[i]) - 1):
    ans += bisect.bisect_left(memo[i], memo[i][j] + k) - 1 - j

print(ans)

### FIXED CODE ###

import bisect

n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n - 1):
  a[i] -= 1
  a[i + 1] += a[i]
a[n - 1] -= 1

memo = {0 : []}
for i in range(n):
  if a[i] % k not in memo.keys():
    memo[a[i] % k] = [i]
  else:
    memo[a[i] % k].append(i)

ans = bisect.bisect_left(memo[0], k - 1)

for i in memo.keys():
  for j in range(len(memo[i]) - 1):
    ans += bisect.bisect_left(memo[i], memo[i][j] + k) - 1 - j

print(ans)
def calcsum(n):
    return n * (n + 1) // 2

s = str(input())
n = len(s) + 1
arrk = []
arrg = []
tmp = s[0]
cnt = 1
for i in range(1, n-1):
    if s[i] == tmp:
        cnt += 1
    elif s[i] != tmp:
        if tmp == '<':
            arrk.append(cnt)
        else:
            arrg.append(cnt)
        cnt = 1
        tmp = s[i]
if tmp == '<':
    arrk.append(cnt)
else:
    arrg.append(cnt)
#print(arrk, arrg)
ans = 0
for i in range(len(arrk)):
    #print(calcsum(arrk[i]-1))
    ans += calcsum(arrk[i]-1)
for i in range(len(arrg)):
    #print(calcsum(arrg[i]-1))
    ans += calcsum(arrg[i]-1)
#print('ans',ans)
if s[0] == '<':
    for i in range(len(arrg)):
        #print('a', max(arrg[i], arrk[i]))
        ans += max(arrg[i], arrk[i])
    if len(arrg) > len(arrk):
        ans += arrg[len(arrg)-1]
    elif len(arrk) > len(arrg):
        ans += arrk[len(arrk)-1]
elif s[0] == '>':
    ans += arrg[0]
    for i in range(len(arrk)-1):
        #print('a', max(arrg[i+1], arrk[i]))
        ans += max(arrg[i+1], arrk[i])
    if len(arrg) > len(arrk):
        ans += arrg[len(arrg)-1]
    elif len(arrk) > len(arrg):
        ans += arrk[len(arrk)-1]
    else:
        if s[n-2] == '<':
        ans += arrk[len(arrk)-1]
print(ans)


### FIXED CODE ###

def calcsum(n):
    return n * (n + 1) // 2

s = str(input())
n = len(s) + 1
arrk = []
arrg = []
tmp = s[0]
cnt = 1
for i in range(1, n-1):
    if s[i] == tmp:
        cnt += 1
    elif s[i] != tmp:
        if tmp == '<':
            arrk.append(cnt)
        else:
            arrg.append(cnt)
        cnt = 1
        tmp = s[i]
if tmp == '<':
    arrk.append(cnt)
else:
    arrg.append(cnt)
#print(arrk, arrg)
ans = 0
for i in range(len(arrk)):
    #print(calcsum(arrk[i]-1))
    ans += calcsum(arrk[i]-1)
for i in range(len(arrg)):
    #print(calcsum(arrg[i]-1))
    ans += calcsum(arrg[i]-1)
#print('ans',ans)
l = min(len(arrg), len(arrk))
m = max(len(arrg), len(arrk))
#print(l, len(arrg), len(arrk))
if s[0] == '<':
    for i in range(l):
        ans += max(arrg[i], arrk[i])
    if l < len(arrk):
        ans += arrk[len(arrk) - 1]
elif s[0] == '>':
    ans += arrg[0]
    #print(arrg[0])
    if l != m:
        for i in range(l):
            #print('a', arrg[i+1], arrk[i], max(arrg[i+1], arrk[i]))
            ans += max(arrg[i+1], arrk[i])
    else:
        for i in range(l-1):
            #print('a', arrg[i+1], arrk[i], max(arrg[i+1], arrk[i]))
            ans += max(arrg[i+1], arrk[i])
    if s[n-2] == '<':
        ans += arrk[len(arrk) - 1]
    if l < len(arrk):
        ans += arrk[len(arrk) - 1]
print(ans)
from sys import stdin

n, k = [int(x) for x in stdin.readline().rstrip().split()]
intense_counters = [0]
dd = [int(x) for x in stdin.readline().rstrip().split()]
intense_counters.extend(dd)

max_intense = False
additional = 0
if k >= n-1:
    print(" ".join(list(map(str, [n]*n))))
else:
    for times in range(k):
        counter = 0
        new_intense_counters = [0] * (n+1)
        add_all = 0
        for i, intense in enumerate(intense_counters):
            if i == 0:
                continue
            intense += additional

            if intense == n-1:
                counter += 1
                add_all += 1
            else:
                min = i - intense
                if min < 1:
                    min = 1
                max = i + intense
                if max > n:
                    max = n

                if min == 1 and max == n:
                    add_all += 1
                else:
                    for lighted_position in range(min, max+1):
                        new_intense_counters[lighted_position] += 1
        if counter == n:
            max_intense = True
            break
        intense_counters = new_intense_counters
        additional = add_all

    if max_intense:
        print(" ".join(list(map(str, [n]*n))))
    else:
        print(" ".join(list(map(str, intense_counters[1:]))))


### FIXED CODE ###

n = input()

print(n[:3])
N = int(input())
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
c = A[0]
d = 0
for i in range(N):
    d += max(0, c - B[i])
    c = max(0, A[i+1] + min(0, c - B[i]))
    
print(sum(A) - (d + c))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
d = 0
c = A[0]

for i in range(N):
    d += max(0, c - B[i])
    c = max(0, A[i+1] + min(0, c - B[i]))
            
            
print(sum(A) - (d + c))
N = int(input())
A = map(int, input().split())
xyz = [0,0,0]
T = 1
for Ai in A:
  T = (T*xyz.count(Ai))%1000000007
  xyz[xyz.index(Ai)] += 1
print(T)


### FIXED CODE ###

N = int(input())
A = map(int, input().split())

T = 1
xyz = [0]*3
for Ai in A:
  if xyz.count(Ai)>0:
    T = (T * xyz.count(Ai))%1000000007
    xyz[xyz.index(Ai)] += 1
  else:
    T = 0
    break
print(T)
N,Q = map(int,input().split())
ab = []
for i in range(n-1):
    x,y = map(int,input().split())
    ab.append([x,y])
ab.sort()
ans = [0]*N
for i in range(Q):
    x,y = map(int,input().split())
    ans[x-1] += y
for i in range(N-1):
    ans[ab[i][1]-1] += ans[ab[i][1] - 1]
print(*ans)

### FIXED CODE ###

n,q=map(int,input().split())
ab=[]
for i in range(n-1):
	x,y=map(int,input().split())
	ab.append([x,y])
ab.sort()
ans=[0]*n
cnt=[0]*n
for i in range(q):
	x,y=map(int,input().split())
	ans[x-1]+=y
for i in range(n-1):
	ans[ab[i][1]-1]+=ans[ab[i][0]-1]
print(*ans)
s=input()
print('A'+input()[8]+'C')

### FIXED CODE ###

print('A'+input()[8]+'C')
n = 10
while n != 0:
 n = input()
 print "Case " + str(i) + ": " +str(n)

### FIXED CODE ###

n = 10
i = 1
while n != 0:
 n = input()
 if n == 0:
     break
 print "Case " + str(i) + ": " +str(n)
 i = i + 1