Can anyone please tell me why this is partially correct


#1

bool is_palindrome(string s)
{
int i;
for(i=0;i<s.length()/2;i++)
{
if(s[i]!=s[s.length()-i-1])
{
return false;
break;
}
}
return true;
}
string Solution::longestPalindrome(string A)
{
vectorv;
int result=0;
string s;
int i,j;
for(i=0;i<A.length();i++)
{
for(j=1;j<=A.length()-i;j++)
{
v.push_back(A.substr(i,j));
}
}
for(i=0;i<v.size();i++)
{
if(is_palindrome(v[i]))
{
if(v[i].length()>result)
{
s=v[i];
result=v[i].length();
}
}
}
return s;
}