Ishaan has bought a new gun. He is practicing his shooting, but he has to reload his gun again and again.
You are given his shooting a bullet and reloading activity in the form of a string S.
String S consists of 2 type of distinct characters :
S: stands for shooting one bullet
R: stands for reloading the gun
You are also given an integer N, which is the bullet capacity of the gun. Each time Ishaan reloads the gun, it is filled up to N bullets.
Given the string S and integer N, find out whether the activities are valid or not ( Refer example for explanation ).
Assume that the gun is loaded upto its full capacity in the beginning of each test case.
The first line of input contains a single integer T denoting the number of test cases.The first of each test case line contains the string S.The second line of each test case contains an integer N.
For each test case, print "1" if the activities are valid, else print "0" (without quotes "") in a new line.
1 <= T <= 100
1 <= N <= 100
1 <= Length of S <= 500
Case 1 :
Gun capacity = 3
Bullets available at beginning = 3
Ishaan shoots 3 bullets and then reloads,
again bullets available are 3 after reload.
Now he shoots 1 bullet and reloads,
bullets available = 3.
Then he shoots 2 bullets.
So the activities are valid.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.