-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10420.cpp
More file actions
40 lines (36 loc) · 759 Bytes
/
Copy path10420.cpp
File metadata and controls
40 lines (36 loc) · 759 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
38
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
int main ()
{
string Country[2000];
int n;
int iCount = 0;
while (cin >> n)
{
string Name;
for (int i=0;i<n;i++)
{
cin>>Country[i];
getline(cin,Name);
}
sort(Country,Country+n);
for (int i=0;i<n;i++)
{
printf("%s ",Country[i].c_str());
int j;
for (j=i;i<n;++j)
{
if (Country[i]!=Country[j])
{
break;
}
iCount++;
}
cout<<iCount<<'\n';
i = j-1;
}
}
}