-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathSPOJ27.cc
More file actions
37 lines (32 loc) · 768 Bytes
/
SPOJ27.cc
File metadata and controls
37 lines (32 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SPOJ 27: Sorting Bank Accounts
// http://www.spoj.com/problems/SBANK/
//
// Solution: String
//
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <map>
#include <vector>
#include <cstring>
#include <functional>
#include <algorithm>
using namespace std;
#define ALL(c) c.begin(), c.end()
#define FOR(i,c) for(typeof(c.begin())i=c.begin();i!=c.end();++i)
#define REP(i,n) for(int i=0;i<n;++i)
char s[10000];
int main() {
int T; scanf("%d", &T);
for (int t = 0; t < T; ++t) {
if (t > 0) printf("\n");
int n; scanf("%d\n", &n);
map<string, int> M;
while (n--) {
gets(s);
M[(string)s]++;
}
FOR(i,M) printf("%s %d\n", i->first.c_str(), i->second);
}
}