Count the characters
Basic Accuracy: 27.15% Submissions: 5430 Points: 1

Given a string S. The task is to count the characters that have ‘N’ number of occurrences. If a character appears consecutively it is counted as 1 occurrence.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow.
Each test case contains a string S and a number N as input.

Output:
For each test case, print the count of characters in new line.

Constraints:
1<=T<=100
1<=|String length |<=104

1<=N<=103

Example:
Input:
2

abc 1
geeksforgeeks 2

Output:
3

4

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.