Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
2,822 views
in Online Assessments by Expert (108,690 points) | 2,822 views

3 Answers

0 like 0 dislike
Best answer

Image of the Q :-

by Expert (108,690 points)
0 like 0 dislike
#include <bits/stdc++.h>
using namespace std;
#define int long long

int32_t main() {
    string str;
    getline(cin, str);
    int f=0;
    string temp="";
    map<string,int>mpp;
    for(int i=0;i<str.size();i++){
        if(str[i]!=' ')
        temp+=str[i];
        else{
        mpp[temp]++;
        temp="";
        }
    }
    mpp[temp]++;
    for(auto it:mpp){
        if(it.second>1){
        f=1;
        cout<<it.first<<" ";
        }
    }
    
    if(f==0)
    cout<<"NA"<<endl;
    return 0;
}
by (400 points)
0 like 0 dislike

Image of question :- 

 

 

 

 

 

by Expert (108,690 points)
0 0
#include <bits/stdc++.h>
using namespace std;
#define int long long

int32_t main() {
    string str;
    getline(cin, str);
    int f=0;
    string temp="";
    map<string,int>mpp;
    for(int i=0;i<str.size();i++){
        if(str[i]!=' ')
        temp+=str[i];
        else{
        mpp[temp]++;
        temp="";
        }
    }
    mpp[temp]++;
    for(auto it:mpp){
        if(it.second>1){
        f=1;
        cout<<it.first<<" ";
        }
    }
    
    if(f==0)
    cout<<"NA"<<endl;
    return 0;
}