-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path185.cpp
More file actions
45 lines (41 loc) · 783 Bytes
/
Copy path185.cpp
File metadata and controls
45 lines (41 loc) · 783 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
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
string strs[100000];
int main() {
int cnt = 0;
string input;
while (getline(cin, input)) {
input = input + " ";
string str = "";
for (int i = 0; i < input.length(); i++) {
if (!((input[i] >= 65 && input[i] <= 90) || (input[i] >= 97 && input[i] <= 122))) {
strs[cnt++] = str;
if (str == "end") {
break;
}
str = "";
}
else {
if (input[i] >= 65 && input[i] <= 90) {
str = str + (char)(input[i] + 32);
}
else {
str = str + input[i];
}
}
}
if (str == "end") {
break;
}
}
sort(strs, strs + cnt);
cout << strs[0];
for (int i = 1; i < cnt; i++) {
if (strs[i] != strs[i - 1]) {
cout << strs[i] << endl;
}
}
return 0;
}