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: EASY
Tags: String algorithms

Data structures
Skill types: Data structures

Starter code:

Solutions:
t = int(input())
for i in range(t):
	p = input()
	count = 0.0
	l = 1
	days = 0
	for i in p:
		count += 1
		if i == '#':
			if count > l:
				l = count
				days += 1
			count = 0
	print(days)


for T in range(int(input())):
	P = input()
	List = P.split('#')
	List = [i for i in List if i != '']
	max_jump = 0
	days = 0
	for i in List:
		if len(i) > max_jump:
			max_jump = len(i)
			days += 1
	print(days)


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)


t = int(input())
for ni in range(t):
	s = input()
	a = s.count('.#')
	if a == 0:
		print(0)
	else:
		m = 0
		c = 0
		cp = 0
		for i in range(len(s)):
			if s[i] == '.':
				c = c + 1
			else:
				if c != 0 and c > cp:
					m = m + 1
				cp = max(c, cp)
				c = 0
		print(m)


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())):
	p = input()
	l = []
	c = 0
	for i in range(len(p)):
		if p[i] == '.':
			c += 1
		elif c != 0:
			l.append(c)
			c = 0
	d = 1
	if len(l) == 0:
		print(0)
	else:
		m = l[0]
		for k in range(len(l)):
			if l[k] > m:
				m = l[k]
				d += 1
		print(d)


for _ in range(int(input())):
	p = input()
	i = 0
	p_s = 0
	c = 0
	l = []
	for j in p:
		if j == '.':
			i = i + 1
		else:
			if i > p_s:
				p_s = i
				c = c + 1
			i = 0
	if i > p_s:
		c = c + 1
	print(c)


for _ in range(int(input())):
	s = input() + '#'
	most = 0
	curr = 0
	days = 0
	for c in s:
		if c == '.':
			curr += 1
		else:
			if curr > most:
				days += 1
				most = curr
			curr = 0
	print(days)


from sys import stdin, stdout
t = int(stdin.readline().rstrip())
while t > 0:
	strg = stdin.readline().rstrip()
	count = 0
	max_jump_count = 0
	jumps = 0
	for i in range(len(strg)):
		if strg[i] == '.':
			count += 1
		else:
			if count > max_jump_count:
				max_jump_count = count
				jumps += 1
			count = 0
	print(jumps)
	t -= 1


for _ in range(int(input())):
	s = input()
	(day, maxi, gap, flag) = (0, 0, 0, 1)
	for i in s:
		if i == '#':
			flag = 1
			if gap > maxi:
				day += 1
				maxi = gap
		elif flag == 0:
			gap += 1
		else:
			flag = 0
			gap = 1
	print(day)


for k in range(0, int(input())):
	arr = input()
	d = 0
	cap = 0
	i = 0
	while i < len(arr):
		if arr[i] == '.':
			st = i
			while arr[i] != '#':
				i += 1
			if cap < i - st:
				d += 1
			if i - st > cap:
				cap = i - st
		else:
			i += 1
	print(d)


t = int(input())
for i in range(t):
	s = input()
	lis = []
	x = s.split('#')
	for i in range(len(x)):
		if len(x[i]) > 0:
			lis.append(x[i])
	count = 1
	if len(lis) == 0:
		print(0)
	else:
		m = lis[0]
		for i in range(len(lis)):
			if lis[i] > m:
				m = lis[i]
				count += 1
		print(count)


for _ in range(int(input())):
	s = input().split('#')
	m = 0
	d = 0
	for i in s:
		if i != '':
			if len(i) > m:
				d += 1
				m = len(i)
	print(d)


for _ in range(int(input())):
	s = input()
	(c, c1, c2) = (0, 0, 0)
	for i in s:
		if i == '.':
			c1 += 1
		else:
			if c1 > 0:
				if c2 < c1:
					c2 = c1
					c += 1
			c1 = 0
	print(c)


for _ in range(int(input())):
	p = input()
	able_to_jump = 0
	count = 0
	days = 0
	for ele in p:
		if ele == '.':
			count += 1
		if ele == '#':
			if count > 0 and count > able_to_jump:
				days += 1
				able_to_jump = count
			count = 0
	print(days)


for i in range(int(input())):
	s = input()
	c = 0
	ju = 0
	cur = 0
	for j in s:
		if j == '#':
			if c > ju:
				ju = c
				cur += 1
			c = 0
		else:
			c += 1
	print(cur)


for _ in range(int(input())):
	s = input()
	lst = []
	count = 0
	for i in s:
		if i == '.':
			count += 1
		else:
			lst.append(count)
			count = 0
	if count != 0:
		lst.append(count)
	val = lst[0]
	day = 0
	for i in range(1, len(lst)):
		if lst[i] > val:
			day += 1
			val = lst[i]
	print(day)


t = int(input())
for _ in range(t):
	floor = str(input())
	arr = [0]
	i = 0
	count = 0
	while i < len(floor) - 1:
		if floor[i] == '.' and floor[i + 1] == '#':
			count = count + 1
			if count > arr[-1]:
				arr.append(count)
			count = 0
		elif floor[i] == '.' and floor[i + 1] == '.':
			count = count + 1
		i = i + 1
	if floor[-1] == '.':
		count = count + 1
		arr.append(count)
	print(len(arr) - 1)


t = int(input())
for _ in range(t):
	s = input()
	max_dot = 0
	current_dot = 0
	days = 0
	for i in range(len(s)):
		if s[i] == '.':
			current_dot += 1
		else:
			if current_dot > max_dot:
				max_dot = current_dot
				days += 1
			current_dot = 0
	if current_dot > max_dot:
		days += 1
	print(days)


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)


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)


t = input()
for c in range(0, int(t)):
	days = 0
	distance = 0
	p = input()
	count = 0
	for x in range(0, len(p)):
		if p[x] == '.':
			count = count + 1
		if count > 0 and p[x] == '#':
			if distance < count:
				distance = count
				days = days + 1
			count = 0
	print(days)


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)


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)


for x in range(int(input())):
	a = input()
	n = len(a)
	days = 0
	c = 0
	i = 0
	while i < n:
		count = 0
		if a[i] == '.':
			while i < n and a[i] == '.':
				count += 1
				i += 1
			if count > days:
				days = count
				c += 1
		else:
			i += 1
	print(c)


t = int(input())
for i in range(t):
	s = str(input())
	l = []
	cou = 0
	for j in s:
		if j == '.':
			cou += 1
		elif 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)


r2 = lambda n: range(1, n + 1)
alph = lambda s: s.isalpha()
mod = lambda n: n % (10 ** 9 + 7)
sl = lambda l: list(set(l))
soli = lambda : sorted(list(map(int, input().split())))
soi = lambda : sorted(input())
ii = lambda : int(input())
li = lambda : list(map(int, input().split()))
si = lambda : input()
lsi = lambda : list(input())
sepi = lambda : map(int, input().split())
seti = lambda : set(map(int, input().split()))
for i in range(int(input())):
	passageway = si()
	if '.' not in passageway:
		print(0)
		continue
	numOfDays = 0
	prevStreak = 0
	idx = 0
	while idx < len(passageway):
		if passageway[idx] == '.':
			currentStreak = 0
			while passageway[idx] == '.':
				currentStreak += 1
				idx += 1
			if prevStreak < currentStreak:
				prevStreak = currentStreak
				numOfDays += 1
		idx += 1
	print(numOfDays)


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)


for _ in range(int(input())):
	s = input()
	(i, t, s1) = (0, 0, 0)
	while i < len(s):
		k = 0
		if s[i] == '.':
			k += 1
			for j in range(i, len(s) - 1):
				if s[j] == s[j + 1]:
					k += 1
				else:
					break
			if k > s1:
				t += 1
				s1 = k
		i += k
		i += 1
	print(t)


for _ in range(int(input())):
	p = input()
	dt = {}
	(gaps, max_jump, days) = (0, 0, 0)
	for i in range(len(p)):
		if p[i] == '.':
			gaps += 1
		else:
			if gaps > max_jump:
				max_jump = gaps
				days += 1
			gaps = 0
	print(days)


for tc in range(int(input())):
	p = input()
	jumpsize = 0
	days = 0
	gapsize = 0
	for i in p:
		if i == '.':
			gapsize += 1
		else:
			if gapsize > jumpsize:
				days += 1
				jumpsize = gapsize
			gapsize = 0
	print(days)


t = int(input())
for _ in range(t):
	passage = input()
	jump = 1
	current = 0
	ans = 0
	for char in passage:
		current += 1
		if char == '#':
			if current > jump:
				jump = current
				ans += 1
			current = 0
	print(ans)


for _ in range(int(input())):
	s = input()
	(ans, cur, m) = (0, 0, 0)
	for i in s:
		if i == '.':
			cur += 1
		else:
			if cur > m:
				m = cur
				ans += 1
			cur = 0
	print(ans)


t = int(input())
for i in range(t):
	string = input()
	jump = 1
	curr = 0
	ans = 0
	for steps in string:
		curr += 1
		if steps == '#':
			if curr > jump:
				jump = curr
				ans += 1
			curr = 0
	print(ans)


testcases = int(input())
for i in range(testcases):
	data = str(input())
	res = []
	count = 0
	for i in data:
		if i == '.':
			count += 1
		elif count >= 1:
			res.append(count)
			count = 0
	ma = 0
	m = 0
	k = 0
	for i in range(len(res)):
		k = ma
		ma = max(res[i], ma)
		if k != ma:
			m += 1
	print(m)


for T in range(int(input())):
	s = str(input())
	List = s.split('#')
	List = [i for i in List if i != '']
	max_jump = 0
	days = 0
	for i in List:
		if len(i) > max_jump:
			max_jump = len(i)
			days += 1
	print(days)


for _ in range(int(input())):
	s = input()
	l = s.split('#')
	l = [i for i in l if i != '']
	ans = 0
	prev = 0
	for i in l:
		if len(i) > prev:
			prev = len(i)
			ans += 1
	print(ans)


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())
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)


for _ in range(int(input())):
	S = input().strip()
	d = 0
	(c, m) = (0, 0)
	for i in S:
		if i == '#':
			if c > m:
				m = c
				d += 1
			c = 0
		else:
			c += 1
	print(d)


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


for _ in range(int(input())):
	p = input()
	cntdot = 0
	cnt = 0
	sume = 0
	for i in range(len(p)):
		if p[i] == '.':
			cnt += 1
		else:
			if cnt > cntdot:
				cntdot = cnt
				sume += 1
			cnt = 0
	if cnt > cntdot:
		sume += 1
	print(sume)


tests = int(input())
for i in range(tests):
	string = input()
	max_jump = 0
	ans = 0
	missing_size = 0
	for j in range(len(string)):
		if string[j] == '.':
			missing_size += 1
		else:
			if missing_size > max_jump:
				max_jump = missing_size
				ans += 1
			missing_size = 0
	if missing_size > max_jump:
		ans += 1
	print(ans)


import sys

def check(idx, n):
	count = 0
	for i in range(idx, n):
		if s1[i] != '.':
			return (count, i - 1)
		count += 1
	return (count, i)
for _ in range(int(input())):
	s1 = input()
	n = len(s1)
	days = i = 0
	max_len = -sys.maxsize + 1
	while i < n:
		if s1[i] == '.':
			(temp, i) = check(i, n)
			if temp > max_len:
				max_len = temp
				days += 1
		i += 1
	print(days)


for _ in range(int(input())):
	s = input()
	td = 0
	v = 0
	v1 = 0
	for i in s:
		if i == '.':
			v += 1
		else:
			if v1 < v:
				td += 1
				v1 = v
			v = 0
	print(td)


for _ in range(int(input())):
	p = input()
	nohas = p.split('#')
	final = []
	for i in nohas:
		if i == '':
			pass
		else:
			final.append(i.count('.'))
	total = 0
	lodu = [0]
	for num in final:
		if num > max(lodu):
			lodu.append(num)
			total += 1
		else:
			pass
	print(total)


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


for _ in range(int(input())):
	s = input()
	steps = 0
	maxsteps = 0
	days = 0
	for i in s:
		if i == '.':
			steps += 1
		elif i == '#':
			if steps > maxsteps:
				maxsteps = steps
				steps = 0
				days += 1
			else:
				steps = 0
				pass
	print(days)


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)


for x in range(int(input())):
	s = input()
	n = len(s)
	i = 0
	listt = []
	while i < n:
		count = 0
		if s[i] == '.':
			while i < n and s[i] == '.':
				count += 1
				i += 1
		else:
			i += 1
		if count > 0:
			listt.append(count)
	if len(listt) == 0:
		print(0)
	else:
		rem = 0
		val = 0
		for i in range(len(listt)):
			if listt[i] > val:
				rem += 1
				val = listt[i]
		print(rem)


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()


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)


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 _ 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)


ujju = int(input())
for T in range(ujju):
	jam = input()
	ju = jam.split('#')
	ju = [p for p in ju if p != '']
	pm = 0
	gh = 0
	for p in ju:
		if len(p) > pm:
			pm = len(p)
			gh += 1
	print(gh)


t = int(input())
for i in range(t):
	p = input()
	l = 0
	count = 0
	max9 = count
	day = 0
	while l < len(p):
		if l == len(p) - 1:
			if count > max9:
				max9 = count
				day += 1
		if p[l] == '.':
			count += 1
			l += 1
		else:
			if count > max9:
				max9 = count
				day += 1
			count = 0
			l += 1
	if max9 == 0:
		print(0)
	else:
		print(day)


n = int(input())
for _ in range(n):
	s = input()
	count = 0
	a = []
	for i in range(len(s)):
		if i == len(s) - 1:
			a.append(count)
		elif s[i] == '.':
			count += 1
		elif s[i] == '#':
			a.append(count)
			count = 0
	m = 0
	count = 0
	for i in a:
		if i > m:
			m = i
			count += 1
	print(count)


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)


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)


t = int(input())
for _ in range(t):
	s = input().split('#')
	l = [i for i in s if i != '']
	days = 0
	prev = 0
	for i in l:
		if len(i) > prev:
			prev = len(i)
			days += 1
	print(days)


for i in range(int(input())):
	string = input()
	a = []
	b = ''
	c = [0]
	for i in range(len(string)):
		if string[i] == '.':
			b = b + string[i]
		if string[i] == '#':
			if b != '':
				a.append(b.count('.'))
				b = ''
	for j in a:
		if j > max(c):
			c.append(j)
	print(len(c) - 1)


for _ in range(int(input())):
	s = input()
	cnt = 0
	cnnt = []
	cnnt.append(0)
	if s.count('.') == 0:
		print(0)
	else:
		for i in range(len(s)):
			if s[i] == '.':
				cnt += 1
			else:
				if cnt <= max(cnnt):
					pass
				elif cnt > 0:
					cnnt.append(cnt)
				cnt = 0
		print(len(cnnt) - 1)


for _ in range(int(input())):
	S = input().strip()
	days = 0
	(curr, maxJ) = (0, 0)
	for i in S:
		if i == '#':
			if curr > maxJ:
				maxJ = curr
				days += 1
			curr = 0
		else:
			curr += 1
	print(days)


for _ in range(int(input())):
	path = input()
	cjd = 1
	nod = 0
	log = 0
	for i in path:
		log += 1
		if i == '#':
			if log > cjd:
				cjd = log
				nod += 1
			log = 0
	print(nod)


for _ in range(int(input())):
	P = input().strip()
	jump = 0
	blank = 0
	days = 0
	for i in range(len(P)):
		if P[i] == '.':
			blank += 1
		else:
			if blank > jump:
				days += 1
				jump = blank
			blank = 0
	print(days)


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)


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)


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))


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] == '#':
			if count > pre:
				ans += 1
				pre = count
			count = 0
		else:
			count += 1
	print(ans)


t = int(input())
for i in range(t):
	str1 = input()
	jump = 1
	current = 0
	ans = 0
	for char in str1:
		current += 1
		if char == '#':
			if current > jump:
				jump = current
				ans += 1
			current = 0
	print(ans)


for i in range(int(input())):
	s = str(input())
	c = 0
	m = 0
	d = 0
	for i in range(len(s)):
		if s[i] == '.':
			c += 1
		else:
			if m < c:
				m = c
				d += 1
			c = 0
	if s[-1] == '.':
		if c > m:
			d += 1
	print(d)


for _ in range(int(input())):
	string = input()
	count = 0
	list1 = []
	for i in string:
		if i == '.':
			count += 1
		elif 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)


def unique(lis):
	lis1 = []
	for i in lis:
		if i not in lis1:
			lis1.append(i)
	return lis1
for i in range(int(input())):
	a = str(input())
	a = unique(a.split('#'))[1:]
	most = 0
	learn = 1
	if a == []:
		print(0)
	else:
		for i in range(len(a)):
			if len(a[most]) < len(a[i]):
				learn += 1
				most = i
		print(learn)


for _ in range(int(input())):
	n = input()
	l = []
	ma_x = 1
	c = 0
	for i in n:
		if i == '.':
			ma_x += 1
			c = 1
		elif i == '#' and c > 0:
			l.append(ma_x)
			ma_x = 1
	c = 0
	ma_x = 0
	for i in l:
		if i > ma_x:
			c += 1
			ma_x = i
	print(c)


t = int(input())
for t in range(t):
	p = input()
	sum = 0
	count = 0
	days = 0
	i = 0
	while i < len(p):
		if p[i] == '.':
			count = 0
			count += 1
			while p[i + 1] != '#':
				count += 1
				i = i + 1
		i = i + 1
		if count > sum:
			sum = count
			days += 1
	print(days)


for i in range(int(input())):
	s = input()
	l = []
	c = 0
	k = 1
	for i in s:
		if i == '.':
			c += 1
		elif c >= 1:
			l.append(c)
			c = 0
	ma = 0
	m = 0
	for i in range(len(l)):
		k = ma
		ma = max(ma, l[i])
		if k != ma:
			m += 1
	print(m)


t = int(input())
for _ in range(t):
	p = input()
	if '.' not in p:
		print(0)
	else:
		prev_streak = 0
		days = 0
		i = 0
		while i < len(p):
			if p[i] == '.':
				streak = 0
				while p[i] == '.':
					streak += 1
					i += 1
				if prev_streak < streak:
					prev_streak = streak
					days += 1
			i += 1
		print(days)


t = int(input())
while t > 0:
	p = input()
	c = d = 0
	count = 0
	n = len(p)
	for i in range(n):
		if p[i] == '.':
			d = d + 1
		else:
			if c < d:
				count = count + 1
				c = d
			d = 0
	print(count)
	t = t - 1