Can somebody will help mee out why this code is failing for larger test cases


#1

long long i,len=A.length();
vector left_to_right(len,0);
vector right_to_left(len,0);
long long c=0;
for(i=1;i<len;i++)
{
if(A[i-1]==‘x’)
{
c=c+1;
}
if(A[i]==‘x’)
left_to_right[i]=left_to_right[i-1];
else
left_to_right[i]=(left_to_right[i-1]+c);
}
c=0;
for(i=len-2;i>=0;i–)
{
if(A[i+1]==‘x’)
{
c=c+1;
}
if(A[i]==‘x’)
right_to_left[i]=right_to_left[i+1];
else
right_to_left[i]=(right_to_left[i+1]+c);
}
long long mini=LONG_MAX,sum;
for(i=0;i<len;i++)
{
sum=(left_to_right[i]%10000003+right_to_left[i]%10000003)%10000003;
mini=min(mini%10000003,sum);
}
return mini%10000003;