Can some one find where i am wrong?


#1

#include
#include
string Solution::solve(string A, string B) {
int a[26]={0};
string c,s1="";

for(int i=0;i<A.size();i++)
{
for(int j=0;j<B.size();j++)
{
if(A[i]==B[j] && a[A[i]-97]==0)
{
s1=s1+B[j];
a[A[i]-97]++;
}
}
}
if(A.size()>s1.size())
{
return “NO”;
}
//cout<<s1;
//c=s1;
for(int i=0;i<=s1.size()-A.size();i++)
{
if( A==s1.substr(i,A.size()) )
{
//return “YES”;
//cout<<"\n YES";
return “YES”;
}

}
return “NO”;
// cout<<"\n NO";

}