char S[N];
int main()
{
scanf("%d", &q);
for (; q; q --)
{
scanf("%s", &S[1]);
n = strlen(S + 1);
// i found this on codechef editorial please help because of this i m not able to get AC what is the concept
Please open this link in this setters solution please have look you will get to know that instead of string data type char array is used which is acting like a string
#include
#include<bits/stdc++.h>
#include
#include
using namespace std;
int A[2][1001];
char s[1001];
int main()
{
int t;
cin>>t;
while(t--)
{
int N;
cin>>s;
N=strlen(s);
for(int i=1; i<=N; i++)
{
for(int j=0; j<=1; j++)
{
A[j][i]=A[j][i-1]+(s[i]==j + '0');
}
}
int mx=N;
for(int w=0; w<=1; w++)
for(int i=1; i<=N; i++)
for(int j=i; j<=N; j++)
mx=min(mx,A[w][i-1]+ (j-i+1) - (A[w][j]-A[w][i-1]) +(A[w][N]-A[w][j]));
cout<<mx<<endl;
memset(A,0,sizeof(A));
memset(s,0,sizeof(s));
}
return 0;
}
//the imediate above is my code this is not running just one sample case if it runs i may get AC please help @rishabhmahajan546