Love Letters!

Lately Fahim is getting a lot of love letters. A LOT of love letters. Since he is confused about whi…

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”.

Print “Love is painful” If one of the admirers fulfill the condition or none of the admirers fulfill the condition ?

If no love letter reaches him that is. :wink:

Yeah, typing mistake in the question.

whats the problem in my code it should work!

bool comp(pair<char,int> a,pair<char,int> b){
    return a.first<b.first;
}
bool is(ll int n){
    fo1(2,sqrt(n)){
        if(n%i==0) return false;
    }
    return true;
}
int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //clock_t time=clock();
    ll int n;
    cin>>n;
    ll int d=1;
    while(n--){
        int r;string t;
        cin>>r>>t;
        string s=t;
        sort(all(s));
        string::iterator it=unique(s.begin(),s.end());
        s.resize(distance(s.begin(),it));
        vector<pair<char,int>> p;
        fo(0,s.size()){
            int tm=count(t.begin(),t.end(),s[i]);
            if(is(tm) && tm!=1) p.pb(make_pair(s[i],tm));
        }
        if(p.size()){
            sort(all(p),comp);
            cout<<"Case "<<d<<":"<<endl;
            fo(0,p.size()){
                cout<<p[i].first<<" = "<<p[i].second<<endl;
            }
        }
        else{
            cout<<"Case "<<d<<":"<<endl<<"Love is painful !";
        }
        d++;
    }
    //clock_t req=clock()-time;
    //cout<<"Time Took :"<<(float)req<<endl;
}

I have just given the functions related to the problem the headers and other essentials are included