Summary Power : What’s wrong with my code?

Summary Power : What’s wrong with my code?

#include <bits/stdc++.h>
using namespace std;

int main() {
    int t ;cin>>t;
    while(t--){
        int n,k;cin>>n>>k;
        vector<char>v(n);
        vector<int>c(n);
        c[0]=1;
        for(int i=0;i<n;i++){
            cin>>v[i];
            if(i>0){
                if(v[i]==v[i-1])
                c[i]+=c[i-1];
                else 
                c[i]=c[i-1]+1;
            }
        }
        

        int ct  = 0;
        for(int i = 0;i<k;i++){
            int a = c[i];
            int b = c[n-k+i];
            ct+=b-a;
        }
        cout<<ct<<endl;
        
    }
    return 0 ; 
}