-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuva-10420.cpp
More file actions
53 lines (41 loc) · 919 Bytes
/
uva-10420.cpp
File metadata and controls
53 lines (41 loc) · 919 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <bits/stdc++.h>
using namespace std;
int main()
{
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
char s[105], dump[105];
string str;
vector<string>LIST;
int test, i, count, Len;
scanf("%d", &test);
while (test--) {
scanf("%s", s);
str = s;
gets(dump);
LIST.push_back(str);
}
sort(LIST.begin(), LIST.end());
/*
for (i = 0; i < LIST.size(); i++) {
cout << LIST[i] << "\n";
}
*/
Len = LIST.size();
str = LIST[0];
i = 1;
count = 1;
while (i != Len) {
if (str == LIST[i]) {
count++;
}
else {
printf("%s %d\n", str.c_str(), count);
str = LIST[i];
count = 1;
}
i++;
}
printf("%s %d\n", str.c_str(), count);
return 0;
}