Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <vector>
- #include <algorithm>
- #include <cmath>
- #include <set>
- #include <unordered_set>
- #include <map>
- #include <string>
- #include <queue>
- #include <cstdlib>
- #include <cstdio>
- using namespace std;
- #define endl '\n'
- #define pb push_back
- #define ff first
- #define ss second
- #define pf push_front
- #define INF 1000000009
- #define go_fast ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
- #define ll long long
- int main() {
- int N;
- cin >> N;
- set <string> a;
- string peep;
- vector <string> b;
- for (int i = 0; i < N; ++i) {
- cin >> peep;
- a.insert(peep);
- b.push_back(peep);
- }
- set <string> solve;
- sort(b.begin(), b.end());
- for (int i = 0; i < N; ++i) {
- for (int g = 0; g < N; ++g) {
- if (a.find(b[i] + b[g]) != a.end()) solve.insert(b[i] + b[g]);
- }
- }
- for (auto f : solve) cout << f << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement