Palindrome antipalindrome-EASY

#include <bits/stdc++.h>

using namespace std;

int main()

{

vector<int> palin,antipalin;

string s;

int t;

cout<<"Enter no of test cases";

cin>>t;

while(t--)

{

    int count1=0,count2=0,i=0;

cout<<"\nEnter binary string ";

cin>>s;

int len=s.length();

for( i=0;i<len;i++)

{

    if(s[i]==s[len-i-1])

     {

        palin.push_back(i);

        count1++;

        

     }

     else

     {

        antipalin.push_back(i);

         count2++;

         

     } 

     

}

cout<<"\n"<<count1<<" "<<count2<<"\n";

for(int i=0;i<count1;i++)

{

cout<<palin[i]<<" ";

}

cout<<endl;

   for(int i=0;i<count2;i++)

{

cout<<antipalin[i]<<" ";

}

}




return 0;

}

someone please help me with this problem… code has been excueting properly but is not submitting

Question link?
Also, Please format your code :slight_smile:

1 Like

First of all, format the code and give the question link! No one is a magician here who will figure out which problem you are facing difficulties in. Also taking a look at the code, I believe there is no need to output statements such as “Please input num”, because the grader considers this as extraneous output. I am pretty sure the problem does not involve printing that statement. Actually even I made the same error in my very first submission, but I soon figured out the mistake.