Chef found a strange string yesterday - a string of signs s, where each sign is either a '<', '=' or a '>'. Let N be the length of this string. Chef wants to insert N + 1 positive integers into this sequence and make it valid. A valid sequence is a sequence where every sign is preceded and followed by an integer, and the signs are correct. That is, if a sign '<' is preceded by the integer a and followed by an integer b, then a should be less than b. Likewise for the other two signs as well. 
Chef can take some positive integers in the range [1, P] and use a number in the range as many times as he wants.
Help Chef find the minimum possible P with which he can create a valid sequence.

-----Input-----
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The only line of each test case contains the string of signs s, where each sign is either '<', '=' or a '>'. 

-----Output-----
For each test case, output a single line containing an integer corresponding to the minimum possible P. 

-----Constraints-----
- 1 ≤ T, |s| ≤ 105
- 1 ≤ Sum of |s| over all test cases in a single test file ≤ 106

-----Subtasks-----
Subtask #1 (30 points)
- 1 ≤ T, |s| ≤ 103
- 1 ≤ Sum of |s| over all test cases in a single test file ≤ 104

Subtask #2 (70 points)
- Original constraints

-----Example-----
Input:
4
<<<
<><
<=>
<=<

Output:
4
2
2
3

-----Explanation-----
Here are some possible valid sequences which can be formed with the minimum P for each of the test cases:
1 < 2 < 3 < 4
1 < 2 > 1 < 2
1 < 2 = 2 > 1
1 < 2 = 2 < 3

Starter code:

Solutions:
for _ in range(int(input())):
 st=input().replace("=","")
 if not len(st):print(1)
 else:
  cu=mx=1
  for j in range(1,len(st)):
   if st[j]==st[j-1]:cu+=1
   else:mx=max(mx,cu);cu=1
  print(max(mx+1,cu+1))


r=int(input())
for z in range(r):
 s=input()
 s=s.replace('=','')
 l=list(s)
 final=0
 ans=0
 if(len(l))==0:
  print(1)
 else:
  for i in range(1,len(l)):
   if(l[i]==l[i-1]):
    ans=ans+1
   else:
    if(final<ans):
     final=ans
    ans=0
  if(final<ans):
     final=ans
  print(final+2)
 


# cook your dish here
def solve(s):
 temp = []
 for c in s:
  if c != '=':
   temp.append(c)
 
 count = 1
 ans = 1
 # print(temp)
 if temp:
  for i in range(1, len(temp)):
   if temp[i] == temp[i-1]:
    count += 1
    # print(i, count)
   else:
    ans = max(ans, count);
    count = 1
  ans = max(ans, count);
  print(ans+1)
 else:
  print(1)
 
n = int(input())
for i in range(n):
 s = input().strip()
 solve(s)

for _ in range(int(input())):
 l=list(input())
 temp=['<','=']
 fg,c=0,0
 ans1,ans2=0,0
 for i in range(len(l)):
  if l[i] in temp:
   fg=1
   if l[i]=='<':
    c+=1
  elif fg==1:
   ans1=max(ans1,c)
   fg=0
   c=0
 if fg==1:
  ans1 = max(ans1, c)
 ans1+=1
 temp=['>','=']
 fg,c=0,0
 for i in range(len(l)):
  if l[i] in temp:
   fg=1
   if l[i]=='>':
    c+=1
  elif fg==1:
   ans2=max(ans2,c)
   fg=0
   c=0
 if fg==1:
  ans2 = max(ans2, c)
 ans2+=1
 print(max(ans1,ans2))

t=int(input())
for z in range(t):
 s=input()
 j=1
 ans=1
 a=[]
 for i in s:
  if i!='=':
   a.append(i)
 if len(a)== 0 :
  print(1)
  continue
 for i in range(len(a)-1):
  if a[i]==a[i+1]:
   j+=1
   ans=max(ans,j)
  else:
   j=1
 print(ans+1)


t=int(input())
for z in range(t):
 s=input()
 j=1
 ans=0
 a=[]
 for i in s:
  if i!='=':
   a.append(i)
 
 for i in range(len(a)-1):
  if a[i]==a[i+1]:
   j+=1
   ans=max(ans,j)
  else:
   j=1

 print(ans+1)


# cook your dish here
import math
t=0
try:
 t = int(input())
except EOFError as e : pass
for _ in range(t):
 myStr = input().replace('=', '')
 if len(myStr) == 0 :
  print(1)
  continue
 ans = 0
 count = 1
 for k in range(len(myStr)-1):
  if myStr[k] == myStr[k+1]:
   count +=1
  else:
   ans = max(count, ans)
   count = 1
 ans = max(count, ans)
 print(ans+1)
 


# cook your dish here
import math
t=0
try:
 t = int(input())
except EOFError as e : pass
for _ in range(t):
 # myStr = input().replace('=', '')
 # if len(myStr) == 0 :
 #     print(1)
 #     continue
 # ans = 0
 # count = 1
 # for k in range(len(myStr)-1):
 #     if myStr[k] == myStr[k+1]:
 #         count +=1
 #     else:
 #         ans = max(count, ans)
 #         count = 1
 #     ans = max(count, ans)
 # print(ans+1)
 s=input().replace('=','')
 if len(s)==0:
  print(1)
  continue
 ans,count=0,1
 for i in range(len(s)-1):
  if s[i]==s[i+1]:
   count+=1
  else:
   ans=max(ans,count)
   count=1
 ans=max(count,ans)
 print(ans+1)


# cook your dish here
import math
t=0
try:
 t = int(input())
except EOFError as e : pass
for i in range(t):
 myStr = input().replace('=', '')
 if len(myStr) == 0 :
  print(1)
  continue
 ans = 0
 count = 1
 for k in range(len(myStr)-1):
  if myStr[k] == myStr[k+1]:
   count +=1
  else:
   ans = max(count, ans)
   count = 1
  ans = max(count, ans)
 print(ans+1)


# cook your dish here
import math
t=0
try:
 t = int(input())
except EOFError as e : pass
for i in range(t):
 myStr = input().replace('=', '')
 if(len(myStr) == 0):
  print(1)
  continue
 ans = 0
 count = 1
 for k in range(len(myStr)-1):
  if(myStr[k] == myStr[k+1]):
   count +=1
  else:
   ans = max(count, ans)
   count = 1
  ans = max(count, ans)
 print(ans+1)


# cook your dish here
import math
t=0
try:
 t = int(input())
except EOFError as e : pass
for i in range(t):
 myStr = input().replace('=', '')
 if(len(myStr) == 0):
  print(1)
  continue
 ans = 0
 count = 1
 for k in range(len(myStr)-1):
  if(myStr[k] == myStr[k+1]):
   count +=1
  else:
   count = 1
  ans = max(count, ans)
 print(ans+1)


x=int(input())
for _ in range(x):
 n=input()
 lol=[]
 for i in n:
  if i!="=":
   lol.append(i)
 n="".join(lol) 
 l=0
 if len(n)>0:
  l+=1
  c=1
  for i in range(1,len(n)):
   if n[i]==n[i-1]:
    c+=1
   else:
    #print(c,l,i)
    l=max(l,c)
    c=1
  l=max(l,c) 
 print(l+1)

T = int(input())

for i in range(T):
 x = input().replace("=", "")
 max_right = 0
 max_left = 0
 curr_right = 0
 curr_left = 0
 right = False
 left = False

 for j in x:
  if j == ">":
   curr_right += 1
   if not right:
    right = True

   if left:
    left = False
    if max_left < curr_left:
     max_left = curr_left

    curr_left = 0

  elif j == "<":
   curr_left += 1
   if not left:
    left = True

   if right:
    right = False
    if max_right < curr_right:
     max_right = curr_right

    curr_right = 0

 if curr_left > max_left: max_left = curr_left
 if curr_right > max_right: max_right = curr_right

 print(max(max_right, max_left) + 1)


t=int(input())
for _ in range(t):
 s=input().replace('=','')
 if len(s)==0:
  print(1)
  continue
 ans,count=0,1
 for i in range(len(s)-1):
  if s[i]==s[i+1]:
   count+=1
  else:
   ans=max(ans,count)
   count=1
 ans=max(count,ans)
 print(ans+1)

for _ in range(int(input())):
 q=input()
 x=0
 o=0
 y=[]
 z=-1
 c=-1
 for ii in range(len(q)):
  if(q[ii]!='='):
   y.append(q[ii])
 for i in range(len(y)):
  if(y[i]=='>')and(o==0):
   x+=1
  elif(y[i]=='<')and(x==0):
   o+=1
  else:
   if(z<o):
    z=o
   if(c<x):
    c=x
   if(y[i]=='>'):
    x=1
    o=0
   if(y[i]=='<'):
    o=1
    x=0
 if(z<o):
  z=o
 if(c<x):
  c=x
 print(max(z,c,0)+1)


for _ in range(int(input())):
 q=input()
 x=0
 o=0
 y='='+q
 z=-1
 c=-1
 for i in range(1,len(y)):
  if(y[i]=='>')and(y[i-1]=='=' or y[i-1]=='>' ):
   x+=1
  elif(y[i]=='<')and(y[i-1]=='=' or y[i-1]=='<' ):
   o+=1
  elif(y[i]=='='):
   continue
  else:
   if(z<o):
    z=o
   if(c<x):
    c=x
   if(y[i]=='>'):
    x=1
    o=0
   if(y[i]=='<'):
    o=1
    x=0
 if(z<o):
  z=o
 if(c<x):
  c=x
 print(max(z,c,0)+1)


for _ in range(int(input())):
 q=input()
 x=0
 o=0
 y='='+q
 z=-1
 c=-1
 for i in range(1,len(y)):
  if(y[i]=='>')and(y[i-1]=='=' or y[i-1]=='>' ):
   x+=1
  elif(y[i]=='<')and(y[i-1]=='=' or y[i-1]=='<' ):
   o+=1
  elif(y[i]=='='):
   continue
  else:
   if(z<o):
    z=o
   if(c<x):
    c=x
   if(y[i]=='>'):
    x=1
    o=0
   if(y[i]=='<'):
    o=1
    x=0
 if(z<o):
  z=o
 if(c<x):
  c=x
 print(max(z,c)+1)


for _ in range(int(input())):
 q=input()
 x=0
 o=0
 y='='+q
 z=-1
 c=-1
 for i in range(1,len(y)):
  if(y[i]=='>')and(y[i-1]=='=' or y[i-1]=='>' ):
   x+=1
  elif(y[i]=='<')and(y[i-1]=='=' or y[i-1]=='<' ):
   o+=1
  else:
   if(z<o):
    z=o
   if(c<x):
    c=x
   if(y[i]=='>'):
    x=1
    o=0
   if(y[i]=='<'):
    o=1
    x=0
 if(z<o):
  z=o
 if(c<x):
  c=x
 print(max(z,c)+1)


# cook your dish here
import math
t=int(input())
while(t>0):
 l=[]
 s1=input()
 s=""
 for i in s1:
  if i!="=":
   s=s+i
 max=-99999
 sum=0
 for i in range(0,len(s)-1):
  if(s[i]!="="):
   sum=sum+1
   #print("here",sum)
   if s[i] != s[i+1]:
    #print(sum)
    if sum>max:
     max=sum
    sum=0
 if len(s)>1 and s[i]!="=":
   if sum+1>max:
    max=sum+1
 if len(s)==1 and s[0]!="=":
  max=1
 if max==-99999:
  print(1)
 else:
  print(max+1)
 t=t-1