Question
int getMatchCount(string s1, string s2) { if(s2.length() == 0 || s1.length() == 0) return -1; else if(s2.length() > s1.length()) return -2; int i=0, j=0, k
int getMatchCount(string s1, string s2)
{
if(s2.length() == 0 || s1.length() == 0)
return -1;
else if(s2.length() > s1.length())
return -2;
int i=0, j=0, k = 0;
int len1, len2;
len1 = s1.length();
len2 = s2.length();
for(i=0;i
{
j=0;
for(j=0;j if(s1[i+j]!=s2[j]) break; if(j == len2) { k++; j = 0; } } return k; } could someone fix this error and rewrite the code for me? C++
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started