Arya has a string, S, of uppercase English letters. She writes down the string S on a paper K times.
She wants to calculate the occurence of a specific letter in the first N characters of the final string.
First line of input contains a single integer T denoting the number of test cases.
The first line of each test case contains a string S.
The second line contains 2 space-separated integers K and N, and an uppercase English letter C whose occurence needs to be counted.
For each test case, print the required answer in a new line.
1 <= T <= 150
1 <= |S| <= 500
1 <= K <= 10^5
1 <= N <= |S|*K
3 7 B
4 6 E
Case 1 : Final string - ABAABAABA
Case 2 : Final string - BHDBHDBHDBHD
Example 2 :
2 4 M
Case 1 : Final string - MMMMMM
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.