Advertisement
QuiteDiamond

Untitled

Dec 10th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <cmath>
  6. #include <set>
  7. #include <unordered_set>
  8. #include <map>
  9. #include <string>
  10. #include <queue>
  11. #include <cstdlib>
  12. #include <cstdio>
  13.  
  14. using namespace std;
  15.  
  16. #define endl '\n'
  17. #define pb push_back
  18. #define ff first
  19. #define ss second
  20. #define pf push_front
  21. #define INF 1000000009
  22. #define go_fast ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
  23. #define ll long long
  24.  
  25.  
  26. int main() {
  27. int N;
  28. cin >> N;
  29. set <string> a;
  30. string peep;
  31. vector <string> b;
  32. for (int i = 0; i < N; ++i) {
  33. cin >> peep;
  34. a.insert(peep);
  35. b.push_back(peep);
  36. }
  37. set <string> solve;
  38. sort(b.begin(), b.end());
  39. for (int i = 0; i < N; ++i) {
  40. for (int g = 0; g < N; ++g) {
  41. if (a.find(b[i] + b[g]) != a.end()) solve.insert(b[i] + b[g]);
  42. }
  43. }
  44. for (auto f : solve) cout << f << endl;
  45. return 0;
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement