so the link to my problem : STRCH Problem - CodeChef
when i submitted my piece of code it got accepted but when ran a simple run i got this runtime error
my code is here :
#include <iostream>
#include <string>
#define ll long long int
using namespace std;
int main() {
int T;
cin>>T;
while (T--){
ll N;
cin>>N;
string s;
char X;
ll Total = (N * (N+1)/2);
cin>>s>>X;
ll last = -1;
s +=X;
for (int i =0; i<=N; ++i){
if(s[i] == X){
ll len = i -last-1 ;
Total-= (len*(len+1))/2;
last = i;
}
}
cout<<Total<<"\n";
} // testases end over here
return 0;
}