Super Shop

A super shop sells only 26 items, labeled them from ‘A’ to ‘Z’. The shop stores the list of products…

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

unsigned long long int a,t,trans,query,b,c,d,e,jun,sen;
double sum,div;
cin>>t;
for(a=1;a<=t;a++)
{

    cin>>trans>>query;
    string artrans[trans],same,x,y;
    for(b=0;b<trans;b++)
    {
        cin>>artrans[b];
    }
    cout<<"Case "<<a<<':'<<endl;

    while(query--)//for(b=0;b<query;b++)
    {
        cin>>x>>y;
        sum=div=0;
        for(c=0;c<trans;c++)
        {
            jun=sen=0;
            same=artrans[c];
            for(d=0;d<same.size();d++)
            {
                for(e=0;e<x.size();e++)
                {
                    if(x[e]==same[d])
                    {
                        jun++;
                    }
                }
                for(e=0;e<y.size();e++)
                {
                    if(y[e]==same[d])
                    {
                        sen++;
                    }
                }

            }
            if(jun==x.size()&&sen==y.size())
            {
                sum++;
                div++;
            }
            else if(jun==x.size())
            {
                div++;
            }

        }
         std::cout << std::fixed;
         std::cout << std::setprecision(2);
        cout<<sum/div<<endl;
    }

how changes do i have to make to avoid cpu limit

}