| 2 | using namespace std; |
| 3 | |
| 4 | int main() |
| 5 | { |
| 6 | int t; // t is the no. of test cases |
| 7 | cin>>t; |
| 8 | while(t--) |
| 9 | { |
| 10 | string s; |
| 11 | cin>>s; |
| 12 | int k,n; |
| 13 | cin>>k>>n; |
| 14 | char c; // c is the character whose occurence need to be counted |
| 15 | cin>>c; |
| 16 | int ext=n%s.size(); // extra string left |
| 17 | int count=0; |
| 18 | for(int i=0;i<ext;i++) // count occurence of character in extra string |
| 19 | { |
| 20 | if(s[i]==c) |
| 21 | count++; |
| 22 | } |
| 23 | int c1=0; |
| 24 | for(int i=0;i<s.size();i++) // count occurence of character in main string |
| 25 | { |
| 26 | if(s[i]==c) |
| 27 | c1++; |
| 28 | } |
| 29 | cout<<c1*(n/s.size())+count<<endl; // occurence in main string repeated (n/>s.size()) times and extra string |
| 30 | } |
| 31 | |
| 32 | return 0; |
| 33 | } |
nothing calls this directly
no outgoing calls
no test coverage detected