instance, in the event that n=7, s=.**.*** and k=3, the accompanying strings will fulfill the conditions above: .xx.*xx; .x*.x*x; .xx.xxx. However, for instance, the accompanying strings won't meet the conditions: .**.*xx (the primary character '*' ought to be sup
Correct answer will be upvoted else downvoted. Computer science.
For instance, in the event that n=7, s=.**.*** and k=3, the accompanying strings will fulfill the conditions above:
.xx.*xx;
.x*.x*x;
.xx.xxx.
However, for instance, the accompanying strings won't meet the conditions:
.**.*xx (the primary character '*' ought to be supplanted with 'x');
.x*.xx* (the last character '*' ought to be supplanted with 'x');
.x*.*xx (the distance between characters at positions 2 and 6 is more noteworthy than k=3).
Given n, k, and s, track down the base number of '*' characters that should be supplanted with 'x' to meet the above conditions.
Input
The primary line contains one integer t (1≤t≤500). Then, at that point, t experiments follow.
The primary line of each experiment contains two integers n and k (1≤k≤n≤50).
The second line of each experiment contains a string s of length n, comprising of the characters '.' and '*'.
It is ensured that there is somewhere around one '*' in the string s.
It is ensured that the distance between any two adjoining '*' characters doesn't surpass k.
Output
For each experiment output the base number of '*' characters that should be supplanted with 'x' characters to fulfill the conditions above.
Step by step
Solved in 3 steps with 1 images