-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathAndys_First_Dictionary.cpp
More file actions
65 lines (54 loc) · 1.18 KB
/
Copy pathAndys_First_Dictionary.cpp
File metadata and controls
65 lines (54 loc) · 1.18 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
int main()
{
set <string> st;
vector <string> V;
string s, s2;
while(cin >> s)
{
int sizeof_string = s.size();
for(int i = 0; i < sizeof_string; i++)
{
if(s[i] >= 65 && s[i] <= 90)
{
s2 += (s[i] + 32);
}
else if(s[i] >= 97 && s[i] <= 122)
{
s2 += s[i];
}
else
{
if(s2.size() != 0)
{
//cout << s2.size() << endl;
V.push_back(s2);
s2.clear();
}
}
}
if(s2.size() != 0)
{
//cout << s2.size() << endl;
V.push_back(s2);
s2.clear();
}
}
sort(V.begin(), V.end());
int sizeof_vector = V.size();
for(int i = 0; i < sizeof_vector; i++)
{
st.insert(V[i]);
}
set <string>::iterator it;
for(it = st.begin(); it != st.end(); it++)
{
cout << *it << endl;
}
return 0;
}