Uqnic no occurence using map set

 avatar
user_6075971
plain_text
2 years ago
586 B
3
Indexable
#include <iostream>
#include<map>
#include <set>
using namespace std;
int main()
{
    map<int,int> m;
    set<int> q;
    int n;
    cout << "ENTER THE MAP VALUE--->";
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int q;
        cout << "ENTER THE ELEMENT--->";
        cin >> q;
        m[q]++;
    }
    for (auto value : m)
    {
        cout<< value.first<<"   " << value.second<<" "<<endl;
    }
    for(auto value:m)
    {
        q.insert(value.second);
    }
    if(m.size()==q.size())
    {
        cout<<"true";
    }
    else
    cout<<"false";
    return 0;
}
Editor is loading...