Hello,
I want to know the reason for (((runtime error (SIGABRT)))) Here is my code:
'#include<iostream>
#include<stdio.h>
#include<string.h>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
//int* counter = new int[1000001];
int t,q,i,k,j,c1,c2;
string str1,str2,str3;
cin>>t;
for(int z = 1; z<=t; z++)
{
vector <int>counter;
cin>>str1>>str2;
for(i=0;i<str1.size();i++)counter.push_back(0);
for(k = 0; k <= (str1.size()-str2.size()); k++)
{
str3 = str1.substr(k,str2.size());
if(str3 == str2)
counter[k+str2.size()-1] = counter[k+str2.size()-2] + 1;
else
counter[k+str2.size()-1] = counter[k+str2.size()-2];
}
//for(k=0;k<str1.size();k++)
//printf("%d ",counter[k]);
scanf("%d",&q);
printf("Case %d:\n",z);
while(q--)
{
scanf("%d%d",&i,&j);
printf("%d\n",counter[j]-counter[i]);
}
}
return 0;
}
'
I have searched about this run time error but I can't find what is specifically wrong with my code that leads to this error
Thanks in advance,