Digory Kirke and Polly Plummer are two kids living next door to each other. The attics of the two houses are connected to each other through a passage. Digory's Uncle Andrew has been secretly doing strange things in the attic of his house, and he always ensures that the room is locked. Being curious, Digory suspects that there is another route into the attic through Polly's house, and being curious as kids always are, they wish to find out what it is that Uncle Andrew is secretly up to.

So they start from Polly's house, and walk along the passageway to Digory's. Unfortunately, along the way, they suddenly find that some of the floorboards are missing, and that taking a step forward would have them plummet to their deaths below.

Dejected, but determined, they return to Polly's house, and decide to practice long-jumping in the yard before they re-attempt the crossing of the passage. It takes them exactly one day to master long-jumping a certain length. Also, once they have mastered jumping a particular length L, they are able to jump any amount less than equal to L as well.

The next day they return to their mission, but somehow find that there is another place further up the passage, that requires them to jump even more than they had practiced for. So they go back and repeat the process.

Note the following:

-  At each point, they are able to sense only how much they need to jump at that point, and have no idea of the further reaches of the passage till they reach there. That is, they are able to only see how far ahead is the next floorboard. 
-  The amount they choose to practice for their jump is exactly the amount they need to get across that particular part of the passage. That is, if they can currently jump upto a length L0, and they require to jump a length L1(> L0) at that point, they will practice jumping length L1 that day. 
-  They start by being able to "jump" a length of 1. 

Find how many days it will take them to cross the passageway. In the input, the passageway is described as a string P of '#'s and '.'s. A '#' represents a floorboard, while a '.' represents the absence of a floorboard. The string, when read from left to right, describes the passage from Polly's house to Digory's, and not vice-versa.

-----Input-----

The first line consists of a single integer T, the number of testcases.
Each of the next T lines consist of the string P for that case.

-----Output-----

For each case, output the number of days it takes them to cross the passage.

-----Constraints-----
-  1  ≤ T  ≤ 1,000,000  (106)
-  1  ≤ |P|  ≤ 1,000,000 (106)
-  The total length of P will be ≤ 5,000,000 (5 * 106)across all test-cases of a test-file 
-  P will consist of only the characters # and . 
-  The first and the last characters of P will be #. 

-----Example-----
Input:
4
####
##.#..#
##..#.#
##.#....#

Output:
0
2
1
2

-----Explanation-----

For the first example, they do not need to learn any jump size. They are able to cross the entire passage by "jumping" lengths 1-1-1.

For the second example case, they get stuck at the first '.', and take one day learning to jump length 2. When they come back the next day, they get stuck at '..' and take one day to learn to jump length 3.

For the third example case, they get stuck first at '..', and they take one day to learn to jump length 3. On the second day, they are able to jump both length 3 as well as length 2 required to cross the passage.

For the last test case they need to stop and learn jumping two times. At first they need to jump a length 2 and then a length 5.

-----Appendix-----

Irrelevant to the problem description, if you're curious about what Uncle Andrew was up to, he was experimenting on Magic Rings that could facilitate travel between worlds. One such world, as some of you might have heard of, was Narnia.

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
for i in range(int(input())):
 s = input()
 m = 0
 p = 0
 d = 0
 l = []
 for i in range(len(s)):
  if(s[i] == "."):
   m = m+1
  elif(s[i] == "#"):
   l.append(m)
   m=0
 for i in range(len(l)):
  if(l[i]>p):
   p = l[i]
   d = d+1
 print(d)
   
  
   
  


t=int(input())
for _ in range(t):
 s=input()
 l,d,m=0,0,0
 for i in range(len(s)):
  if s[i]=='.':
   l+=1
  if s[i]=='#' :
   if l>m: 
    d+=1
    m=l
   l=0
 print(d)

# cook your dish here
test_case = int(input())
while test_case :
 
 passage = input()
 n = len(passage)
 
 count_days = 0 
 jump = 0
 i = 0 
 while i < n:
 
  if passage[i] == '.' :
   count_empty = 1 
   k = i + 1
   while(passage[k] == '.' ) :
    count_empty += 1
    k += 1
   if count_empty > jump :
    count_days += 1
    jump = count_empty 
  
   i = k 
  else:
   i += 1
 
 print(count_days)
 test_case -= 1
 
 
 
 
 
 
 
 
 
 


# cook your dish here
t=int(input())
for i in range(t):
 s=input()
 count=0
 pre=0
 ans=0
 for val in range(len(s)):
  if s[val]=="#":
   # print(count,pre)
   if count>pre:
    # print(ans)
    ans+=1
    pre=count
    # count=0
   count=0
  else:
   count+=1
 print(ans)
 
 
 # pos=s[0]
 # for k in range(len(s)-1):
 #     if s[k+1]=="#":
 #         pos=s[k+1]
 #     else:
   
 #         if counter


def solve(S):
 
 
 i = 0
 count = 0
 L = 0
 n = len(S)
 end = False
 size = 0
 while (i<n):
   
  if S[i] == '.':
   size +=1
   
  elif size!=0:
   if size>L:
    count+=1
    L = size
   size = 0
   
  i+=1
   
 return count


t = int(input())
for _ in range(t):
 s = input()
 print(solve(s))

# https://www.codechef.com/problems/ATTIC

T = int(input())

for t in range(T):
 s = input()
 L = len(s)
 days = 0
 i = 0
 jump_len_known = 1
 
 while i < L:
  while i < L and s[i] == '#':
   i += 1
  
  if i < L:
   j = i + 1
   
   while j < L and s[j] == '.':
    j += 1
    
   jump_len = j - i + 1
   
   if jump_len_known < jump_len:
    days += 1
    jump_len_known = jump_len
    
   i = j

 print(days)


# cook your dish here
t=int(input())
for _ in range(t):
 p=input()
 
 cnt,maxi,ans = 1,1,0
 
 for i in p:
  
  if i=='#' and cnt!=1:
   if cnt>maxi:
    maxi=cnt
    ans+=1
    
   cnt=1
   
  elif i=='.':
   cnt+=1
   
  elif i=='#' and cnt==1:
   continue
  
 if cnt!=1:
  if cnt>maxi:
   ans+=1
   
 print(ans)

def __starting_point():
 for _ in range(int(input())):
  s = input()
  L, count, days = 0, 0, 0
  for c in s:
   if(c == "#"):
    if(count > L):
     days += 1
     L = count
    count = 0
   else:
    count += 1
  if(count > L):
   days += 1
  print(days)

__starting_point()

def __starting_point():
 for _ in range(int(input())):
  s = input()
  L, count, days = 0, 0, 0
  for c in s:
   if(c == "#"):
    if(count > L):
     days += 1
     L = count
    count = 0
   else:
    count += 1
  if(count > L):
   days += 1
  print(days)

__starting_point()

t = int(input())
for _ in range(t):
 w = str(input()).split('#')
 day = 0
 jump = 0
 for i in w:
  if len(i)>jump:
   jump = len(i)
   day+=1
 print(day)# cook your dish here


t=int(input())
for _ in range(t):
 n=input()
 s=0
 p=0
 h=0
 if(len(n)==1):
  if(n[0]=='.'):
   print(1)
  else:
   print(0)
 else:
  for i in range(len(n)-1):
   if(n[i]=='.'):
    p+=1
    if(n[i+1]=='#' or i+1==len(n)-1):
     if(p>s):
      h+=1
      s=p
     p=0
  if(h==0 and n[len(n)-1]=='.'):
   print(1)
  else:
   print(h)
    


t = int(input())
for _ in range(t) :
 path = str(input()).split('#')
 c = 0
 jump = 0
 for i in path :
  if len(i) > jump :
   jump = len(i)
   c += 1
 print(c)

T = int(input())
ans = []

for _ in range(T):
 P = input()

 N = len(P)
 days = 0
 jumping_length = 1
 i = 0
 while(i<N):
  if(P[i]=='.'):
   j = i
   while(j<N and P[j]=='.'):
    j += 1
   if(j-i+1 > jumping_length):
    jumping_length = j-i+1
    days += 1
   i = j
  else:
   i += 1
 ans.append(days)

for i in ans:
 print(i)

# cook your dish here
for i in range(int(input())):
 p=input()
 l=len(p)
 arr=[0]
 count=0
 for j in range(l):
  if(p[j]=='.'):
   count=count+1
  elif(count>0 and p[j]=='#'):
   if(max(arr)<count):
    arr.append(count)
   count=0
 print(len(set(arr))-1)

# cook your dish here
for t in range(int(input())):
 path = input()
 mx = 0
 it = 0
 count = 0

 while it < len(path):

  if path[it] == '.':
   temp = 0

   while path[it] == '.':
    temp += 1
    it += 1

   if temp > mx:
    count += 1
    mx = temp

  else:
   it += 1

 print(count)





# cook your dish here
t=int(input())
for _ in range(t):
 arr=input()
 i=0
 temp=[]
 while i<len(arr):
  count=0
  while i<len(arr) and arr[i]=='#':
   i+=1
  while i<len(arr) and arr[i]=='.':
   count+=1
   i+=1
  if count!=0 and count not in temp:
   temp.append(count)
 check,day=-1,0
 for ele in temp:
  if ele>check:
   day+=1
   check=ele
 print(day)
 


# cook your dish here
from sys import stdin,stdout
t=int(stdin.readline())

def attic(s):
 c=0
 l=[]
 k=0
 m=0
 for i in range(len(p)):
  if s[i]=='.':
   c+=1
  else:
   if c > k:
    k=c
    m+=1
    l.append(c)
   
   c=0
 return m
  
for _ in range(t):
 p=input()
 r=attic(p)
 print(r)

# cook your dish here
t=int(input())

def attic(s):
 c=0
 l=[]
 k=0
 m=0
 for i in range(len(p)):
  if s[i]=='.':
   c+=1
  else:
   if c > k:
    k=c
    m+=1
    l.append(c)
   
   c=0
 return m
  
for _ in range(t):
 p=input()
 r=attic(p)
 print(r)

# cook your dish here
t=int(input())

def attic(s):
 c=0
 l=[]
 k=0
 for i in range(len(p)):
  if s[i]=='.':
   c+=1
  else:
   if c > k:
    k=c
    l.append(c)
   
   c=0
 return len(set(sorted(l)))
  
for _ in range(t):
 p=input()
 r=attic(p)
 print(r)

t = int(input())
while t > 0:
 s = input()
 c = 0
 mx = 0
 d = 0
 for i in range(len(s)):
  c = 0
  if s[i] == '.' and s[i - 1] != '.':
   while s[i] != '#':
    c += 1
    i += 1
   if c > mx:
    d += 1
    mx = c
 print(d)
 t = t - 1


t=int(input())
for i in range(t):
 s=list(input())
 mx=0
 count=0
 c=0
 for j in range(len(s)):
  if s[j]=='.':
   count+=1
  else:
   if count>mx:
    c+=1
   mx=max(mx,count)
   count=0
 print(c)


for _ in range(int(input())):
 s = input()
 n = len(s)
 cnt = 0
 ans =0
 c =0
 for i in range(n):
  if s[i]=='.':
   cnt+=1
  else:
   if cnt > ans:
    c+=1
   ans = max(ans,cnt)
   cnt=0
 print(c)

for _ in range(int(input())):
 string = input()
 count = 0
 list1 = []
 for i in string:
  if i=='.':
   count+=1
  else:
   if count!=0:
    list1.append(count)
    count = 0
 if len(list1)==0:
  print(0)
 else:
  ans = 1
  count = list1[0]
  for a in list1:
   if a>count:
    ans+=1
    count = a
  print(ans)


# cook your dish here
for _ in range(int(input())):
 p=input()
 i=0
 count=0
 result=0
 s=0
 while i<len(p):
  if p[i]=='.':
   while p[i]!='#':
    count+=1 
    i+=1 
   if result<count:
    result=count
    s+=1
   count=0
  else:
   i+=1
 print(s)


t=int(input())
for i in range(t):
 s=str(input())
 l=[]
 cou=0
 for j in s:
  if(j=='.'):
   cou+=1
  else:
   if(cou!=0):
    l.append(cou)
    cou=0
 if(len(l)==0):
  print(0)
 else:
  cou=l[0]
  ans=1
  for j in l:
   if(j>cou):
    ans+=1
    cou=j
  print(ans)