#include "iostream"
#include "string"
#include "map"
{
int n;
cin>>n;
map<string,int>hc_Map;
string t;
map<string,int>::iterator it;
for(int i=0;i<n;i++)
{
cin>>t;
hc_Map.insert(pair<string,int>(t,hc_Map[t]++));
}
it=hc_Map.begin();
for(;it!=hc_Map.end();it++)
{
cout<<it->first<<" ";
cout<<it->second<<endl;
}
cout<<"~~~~~~~~~~~~~"<<endl;
for(;it!=hc_Map.end();it++)
{
cout<<it->first<<" ";
cout<<it->second<<endl;
}
return 0;
for(;it!=hc_Map.end();it++)
{
cout<<it->first<<" ";
cout<<it->second<<endl;
}
return 0;
}
#include "string"
#include "map"
using namespace std;
{
int n;
cin>>n;
map<string,int>hc_Map;
string t;
map<string,int>::iterator it;
for(int i=0;i<n;i++)
{
cin>>t;
hc_Map.insert(pair<string,int>(t,hc_Map[t]++));
}
it=hc_Map.begin();
for(;it!=hc_Map.end();it++)
{
cout<<it->first<<" ";
cout<<it->second<<endl;
}
cout<<"~~~~~~~~~~~~~"<<endl;
// cout<<hc_Map.erase(2)<<endl;
cout<<"~~~~~~~~~~~~~"<<endl;
it=hc_Map.begin();for(;it!=hc_Map.end();it++)
{
cout<<it->first<<" ";
cout<<it->second<<endl;
}
return 0;
}
------------------------------------------------------------
#include "iostream"
#include "string"
#include "map"
using namespace std;
int main()
{
int n;
int t;
cin>>n;
map<int,int>hc_Map;
for(int i=0;i<n;i++)
{
cin>>t;
hc_Map[t]++;
}
map<int,int>::iterator it;
for(it=hc_Map.begin();it!=hc_Map.end();it++)
{
cout<<it->first<<" ";
cout<<it->second<<endl;
}
cout<<"~~~~~~~~~~~~~"<<endl;
cout<<hc_Map.erase(2)<<endl;
cout<<"~~~~~~~~~~~~~"<<endl;
it=hc_Map.begin();for(;it!=hc_Map.end();it++)
{
cout<<it->first<<" ";
cout<<it->second<<endl;
}
return 0;
}