fork download
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <string>
  3. #include <algorithm>
  4. #include <iostream>
  5. #include<vector>
  6. #include<map>
  7. #include <stack>
  8. #include <deque>
  9. #include <cmath>
  10. #include <queue>
  11. #include <set>
  12. #include<unordered_map>
  13. using namespace std;
  14. typedef long long ll;
  15. typedef unsigned long long ull;
  16. typedef long double ld;
  17. typedef vector<int> vi;
  18. #define Fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  19. #define endl '\n'
  20. #define sz(s) (int)(s.size())
  21. #define all(s) s.begin(),s.end()
  22. #define allr(s) s.rbegin(), s.rend()
  23. #define exit(s) return cout<<s,0;
  24. #define watch(x) cout << (#x) << " = " << x << endl
  25. void file() {
  26. #ifndef ONLINE_JUDGE
  27. freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout);
  28. #endif
  29. }
  30.  
  31. int main() {
  32.  
  33. string s, x;
  34. set<string>st;
  35. while (getline(cin, s)) {
  36.  
  37. for (int i = 0; i < sz(s); i++)
  38. {
  39.  
  40. if (isalpha(s[i]) || s[i] == '-')
  41. {
  42. if (isalpha(s[i]))
  43. s[i] = tolower(s[i]);
  44. x += s[i];
  45.  
  46. }
  47.  
  48. else
  49. {
  50.  
  51.  
  52. if (s[i] == ' ')
  53. {
  54. if (x != "" && x != " ")
  55. {
  56. st.emplace(x);
  57.  
  58. }
  59. x = "";
  60.  
  61. }
  62. else
  63. {
  64.  
  65. x += s[i];
  66. }
  67.  
  68.  
  69. }
  70.  
  71.  
  72.  
  73. }
  74. if (x != "" && x != " ")
  75. {
  76. st.emplace(x);
  77. x = "";
  78. }
  79.  
  80. }
  81.  
  82. auto it1 = st.end();
  83. it1--;
  84.  
  85.  
  86. for (auto it : st)
  87. {
  88.  
  89.  
  90. cout << it << endl;
  91.  
  92. }
  93.  
  94. }
Success #stdin #stdout 0s 4440KB
stdin
Adventures
in
Disneyland
Two blondes were going to Disney-land
when they came to a
fork in the road.
The sign read: "Disneyland Left."
So they went home.
stdout
"disneyland
a
adventures
blondes
came
disney-land
disneyland
fork
going
home.
in
left."
read:
road.
sign
so
the
they
to
two
went
were
when