Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

A string is said to be using *strong language* if it contains at least $K$ consecutive characters '*'.

You are given a string $S$ with length $N$. Determine whether it uses strong language or not.

------  Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first line of each test case contains two space-separated integers $N$ and $K$.
The second line contains a single string $S$ with length $N$. 

------  Output ------
Print a single line containing the string "YES" if the string contains strong language or "NO" if it does not (without quotes).

You may print each character of each string in uppercase or lowercase (for example, the strings "yEs", "yes", "Yes" and "YES" will all be treated as identical).

------  Constraints  ------
$1 ≤ T ≤ 10$
$1 ≤ K ≤ N ≤ 10^{6}$
$S$ contains only lowercase English letters and characters '*'
Sum of $N$ over all testcases is atmost $10^{6}$.

------  Subtasks ------
Subtask #1 (30 points): $N ≤ 10^{4}$, Sum of $N$ over all testcases is atmost $10^{4}$

Subtask #2 (70 points): original constraints

----- Sample Input 1 ------ 
3

5 2

*a*b*

5 2

*ab

5 1

abcde
----- Sample Output 1 ------ 
NO

YES

NO
----- explanation 1 ------ 
Example case 1: Since there are no two consecutive characters '*', the string does not contain strong language.

Example case 2: There are two adjacent characters '*', so the string contains strong language.

Example case 3: Since there are no characters '*' in the string, it does not contain strong language.

Difficulty: EASY
Tags: Range queries

Amortized analysis

Data structures

Implementation
Skill types: Data structures

Amortized analysis

Range queries

Starter code:

Solutions:
def has_strong_language(s, k):
	count = 0
	for c in s:
		if c == '*':
			count += 1
			if count >= k:
				return 'YES'
		else:
			count = 0
	return 'NO'
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	print(has_strong_language(s, k))


b = int(input())
for i in range(b):
	a = list(map(int, input().split()))
	c = list(input())
	f = 'NO'
	count = 0
	for i in range(len(c)):
		if c[i] == '*':
			count = count + 1
		else:
			count = 0
		if count == a[1]:
			f = 'YES'
			break
	print(f)


t = int(input())
for i in range(t):
	(n, k) = map(eval, input().split())
	s = input()
	count = 0
	for c in s:
		if c == '*':
			count += 1
		else:
			count = 0
		if count == k:
			print('YES')
			break
	else:
		print('NO')


def solve():
	(n, k) = map(int, input().split())
	a = input()
	cur_len = 0
	flg = False
	for i in range(n):
		if a[i] == '*':
			cur_len += 1
		else:
			if cur_len >= k:
				flg = True
				break
			cur_len = 0
	if flg:
		print('YES')
	elif cur_len >= k:
		print('YES')
	else:
		print('NO')
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	count = 0
	l = 0
	for i in s:
		if i == '*':
			count += 1
			if count == k:
				l += 1
				break
		else:
			count = 0
	if l == 1:
		print('YES')
	else:
		print('NO')


tc = int(input())
for i in range(tc):
	(length, stars) = map(int, input().split())
	string = input()
	starsCount = 0
	Condition = 0
	for j in string:
		if j == '*':
			starsCount += 1
			if starsCount == stars:
				Condition += 1
				break
		else:
			starsCount = 0
	if Condition >= 1:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	(N, K) = map(int, input().split())
	S = input()
	c = 0
	M = 0
	for j in S:
		if j == '*':
			c += 1
			if c == K:
				M += 1
				break
		else:
			c = 0
	if M >= 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	(n, k) = map(int, input().split())
	s = input()
	(c, f) = (0, 0)
	for i in s:
		if i == '*':
			c += 1
			if c == k:
				f += 1
				break
		else:
			c = 0
	print('YES') if f == 1 else print('NO')
	t -= 1


for i in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	count = 0
	flag = 0
	for j in range(n):
		if s[j] == '*':
			count = count + 1
			if count >= k:
				flag = 1
				break
		else:
			count = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()[:n]
	c = k
	d = 0
	for i in s:
		if i == '*':
			c = c - 1
		elif c == 0:
			break
		else:
			c = k
	if c == 0:
		print('YES')
	else:
		print('NO')


q = int(input())
while q > 0:
	(n, k) = map(int, input().split())
	s = input()
	c = 0
	flag = 0
	for i in s:
		if i == '*':
			c = c + 1
			if c >= k:
				flag = 1
				break
		else:
			c = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')
	q = q - 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	cur = 0
	ans = 'NO'
	for i in s:
		if i == '*':
			cur += 1
			if cur >= k:
				ans = 'YES'
				break
		else:
			cur = 0
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	s = input()
	c = 0
	d = 0
	for i in range(0, len(s)):
		if s[i] == '*':
			c += 1
		else:
			c = 0
		if c >= b:
			d = c
	if d >= b:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = input()
	s = m
	for i in a:
		if i == '*':
			s -= 1
		elif s == 0:
			break
		else:
			s = m
	if s == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	c = 0
	d = 0
	for i in range(0, len(s)):
		if s[i] == '*':
			c += 1
		else:
			c = 0
		if c >= k:
			d = c
	if d >= k:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = input()
	d = 0
	e = 0
	for j in range(a):
		if c[j] == '*':
			d += 1
		else:
			d = 0
		if d > e:
			e = d
	if e >= b:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	string = str(input())
	l = 0
	j = 0
	for i in range(n):
		if string[i] == '*':
			l += 1
			if l == k:
				j = 1
				break
		else:
			l = 0
	if j == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	x = 0
	for i in range(n):
		if s[i] == '*':
			x += 1
		elif x == k:
			break
		else:
			x = 0
	print('YES' if x == k else 'NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	string = input()
	li = list()
	c = 0
	for i in string:
		if i == '*':
			c += 1
		else:
			c = 0
		li.append(c)
	strong = max(li)
	if strong >= k:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	(x, k) = map(int, input().split())
	l = input()
	reset = 0
	count = 0
	for i in l:
		if i == '*' and reset == 0:
			count += 1
			reset = 1
		elif i == '*' and reset == 1:
			count += 1
		else:
			reset = 0
			count = 0
		if count == k:
			print('YES')
			break
	if count != k:
		print('NO')
	t -= 1


for tc in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	ans = 'NO'
	cnt = 0
	for i in s:
		if i == '*':
			cnt += 1
		else:
			cnt = 0
		if cnt == k:
			ans = 'YES'
			break
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	s = input()
	l = len(s)
	c = 0
	for j in range(l):
		if s[j] == '*':
			c = c + 1
		else:
			c = 0
		if c == b:
			break
	if c == b:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	c = 1
	m = 1
	for i in range(n - 1):
		if s[i] == '*' and s[i + 1] == '*':
			c += 1
			m = max(m, c)
		else:
			c = 1
	if k == 1:
		print(('NO', 'YES')[s.count('*') > 0])
	else:
		print(('NO', 'YES')[m >= k])


for i in range(int(input())):
	(a, b) = map(int, input().split())
	str1 = input()
	seq = ''
	cnt = 0
	for i in str1:
		if i == '*':
			seq += i
			cnt += 1
		else:
			seq = ''
			cnt = 0
		if cnt == b:
			break
	if cnt == b:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input() + '.'
	acc = 0
	ans = 'NO'
	for c in s:
		if c == '*':
			acc += 1
		else:
			if acc >= k:
				ans = 'YES'
				break
			acc = 0
	print(ans)


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	R = input()
	s = 0
	flag = 1
	for i in range(0, len(R)):
		if R[i] == '*':
			s += 1
			if s == y:
				flag = 0
				break
		else:
			s = 0
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = list(map(int, input().split()))
	s = input()
	x = ''
	for i in range(len(s)):
		if s[i] != '*':
			x += '0'
		else:
			x += '*'
	lis = []
	y = x.split('0')
	for i in range(len(y)):
		if len(y[i]) >= n[1]:
			lis.append(1)
			break
	if 1 in lis:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split(' ')]
	s = input()
	c = 0
	flag = 1
	for i in range(len(s)):
		if s[i] == '*':
			c += 1
			if c == b:
				flag = 0
				break
		else:
			c = 0
	if flag == 0:
		print('YES')
	else:
		print('NO')


try:
	testcases = int(input())
	while testcases:
		(N, K) = map(int, input().split())
		S = input()
		count = 0
		flag = 0
		for character in S:
			if character == '*':
				count += 1
			elif count == K:
				flag = 1
				break
			else:
				count = 0
		if flag == 1 or count == K:
			print('YES')
		else:
			print('NO')
		testcases -= 1
except:
	pass


for i in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	c = ans = 0
	for j in s:
		if c == k:
			ans = 1
			break
		if j == '*':
			c += 1
		if j != '*':
			c = 0
	if c == k:
		ans = 1
	if ans == 0:
		print('NO')
	if ans == 1:
		print('YES')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	l1 = []
	c = 0
	for i in range(len(s)):
		if s[i] != '*':
			l1.append(i)
	l1.insert(0, -1)
	l1.append(len(s))
	for i in range(len(l1) - 1):
		if l1[i + 1] - l1[i] - 1 >= k:
			c = 1
	if c == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	cnt = maxi = 0
	for ch in s:
		if ch != '*':
			cnt = 0
		else:
			cnt += 1
		maxi = max(maxi, cnt)
	if maxi < k:
		print('NO')
	else:
		print('YES')


T = int(input())
for i in range(T):
	(N, K) = [int(i) for i in input().split()]
	S = input()
	c = 0
	l = []
	for i in S:
		if i == '*':
			c += 1
		else:
			c = 0
		l.append(c)
	if max(l) >= K:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = input()
	c = 0
	l = []
	for i in s:
		if i == '*':
			c = c + 1
		else:
			c = 0
		l.append(c)
	if max(l) >= k:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	lang = input()
	cnt = 0
	for i in range(n):
		if lang[i] == '*':
			cnt += 1
			if cnt == k:
				print('YES')
				break
		else:
			cnt = 0
	else:
		print('NO')


for tc in range(int(input())):
	(N, K) = list(map(int, input().split()))
	S = input()
	c = 0
	for i in S:
		if i == '*':
			c += 1
			if c == K:
				print('YES')
				break
		else:
			c = 0
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = str(input())
	ans = 'NO'
	count_of_multiply_sign = 0
	for j in range(len(s)):
		if s[j] == '*':
			count_of_multiply_sign += 1
		else:
			count_of_multiply_sign = 0
		if count_of_multiply_sign >= k:
			ans = 'YES'
			break
	print(ans)