SPOJ SBANK

Problem Link

Process

Map!

#Solution

#include <bits/stdc++.h>
using namespace std;

int main() {
int n,t,i;
cin>>t;
while(t–)
{map<string,int>mp;
map<string,int>::iterator it;
cin>>n;
string s;
cin.ignore();
for(i=0;i<n;i++)
{
getline(cin,s);
mp[s]++;
}
for(it=mp.begin();it!=mp.end();it++)
cout<<(*it).first<<” “<<(*it).second<<endl;
if(t>0)
cout<<endl;
}

return 0;
}

Advertisements

About waprogramming

I am in CSE,from CUET
This entry was posted in spoj, Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s