https://www.codechef.com/problems/CHEFSPL

Can anybody say what’s wrong with my code…

#include <bits/stdc++.h>

using namespace std;

int main(){

int t;cin>>t;

while(t--){

    string s;cin>>s;

    int flag=0;

    unordered_map<char,int>mp;

    int single=0;

   for(auto ch:s){

       mp[ch]++;

   }

   for(auto ch:s){

       if(mp[ch]==1) single++;

   }

    if(single>1) cout<<"NO"<<endl;

    else{

        string s1="";

        for(auto ch:s){

            if(mp[ch]>1) s1 =s1+ch;

        }

        int a =s1.size();

        for(int i=0;i<a/2;i++){

            if(s1[i]!=s1[a/2+i]){

                cout<<"NO"<<endl;

                flag=1;

                break;

            }

        }

        if(flag==0){

            cout<<"YES"<<endl;

        }

        

    }

}

}

@shubhamk9123
Just return 0 at the end or make it void main() at start

There is no need to return 0 it will only give warning and not any type of error.

Try this testcase
1
a
Your output - YES
Correct output -NO